4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
10 Patch 6.2.448 (after 6.2.427)
11 Problem: Mac: conversion done when 'termencoding' differs from 'encoding'
12 fails when pasting a longer text.
13 Solution: Check for an incomplete sequence at the end of the chunk to be
14 converted. (Eckehard Berns)
18 *** ../vim-6.2.447/src/mbyte.c Sun Apr 4 16:30:29 2004
19 --- src/mbyte.c Sun Apr 4 22:25:08 2004
23 * vcp->vc_type must have been initialized to CONV_NONE.
24 * Note: cannot be used for conversion from/to ucs-2 and ucs-4 (will use utf-8
26 + * Afterwards invoke with "from" and "to" equal to NULL to cleanup.
27 * Return FAIL when conversion is not supported, OK otherwise.
36 + #if defined(FEAT_GUI) || defined(AMIGA) || defined(WIN3264) \
37 + || defined(MSDOS) || defined(PROTO)
39 * Do conversion on typed input characters in-place.
40 * The input and output are not NUL terminated!
45 return convert_input_safe(ptr, len, maxlen, NULL, NULL);
50 * Like convert_input(), but when there is an incomplete byte sequence at the
56 ! static char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, CFStringEncoding from, CFStringEncoding to));
59 ! * A Mac version of string_convert() for special cases.
62 ! mac_string_convert(ptr, len, lenp, fail_on_error, from, to)
67 CFStringEncoding from;
72 int buflen, in, out, l, i;
74 cfstr = CFStringCreateWithBytes(NULL, ptr, len, from, 0);
77 if (to == kCFStringEncodingUTF8)
82 ! static char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, CFStringEncoding from, CFStringEncoding to, int *unconvlenp));
85 ! * A Mac version of string_convert_ext() for special cases.
88 ! mac_string_convert(ptr, len, lenp, fail_on_error, from, to, unconvlenp)
93 CFStringEncoding from;
99 int buflen, in, out, l, i;
101 + if (unconvlenp != NULL)
103 cfstr = CFStringCreateWithBytes(NULL, ptr, len, from, 0);
104 + /* When conversion failed, try excluding bytes from the end, helps when
105 + * there is an incomplete byte sequence. Only do up to 6 bytes to avoid
106 + * looping a long time when there really is something unconvertable. */
107 + while (cfstr == NULL && unconvlenp != NULL && len > 1 && *unconvlenp < 6)
111 + cfstr = CFStringCreateWithBytes(NULL, ptr, len, from, 0);
115 if (to == kCFStringEncodingUTF8)
118 case CONV_MAC_LATIN1:
119 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
120 kCFStringEncodingMacRoman,
121 ! kCFStringEncodingISOLatin1);
124 case CONV_LATIN1_MAC:
125 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
126 kCFStringEncodingISOLatin1,
127 ! kCFStringEncodingMacRoman);
131 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
132 kCFStringEncodingMacRoman,
133 ! kCFStringEncodingUTF8);
137 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
138 kCFStringEncodingUTF8,
139 ! kCFStringEncodingMacRoman);
144 case CONV_MAC_LATIN1:
145 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
146 kCFStringEncodingMacRoman,
147 ! kCFStringEncodingISOLatin1,
151 case CONV_LATIN1_MAC:
152 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
153 kCFStringEncodingISOLatin1,
154 ! kCFStringEncodingMacRoman,
159 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
160 kCFStringEncodingMacRoman,
161 ! kCFStringEncodingUTF8,
166 retval = mac_string_convert(ptr, len, lenp, vcp->vc_fail,
167 kCFStringEncodingUTF8,
168 ! kCFStringEncodingMacRoman,
173 *** ../vim-6.2.447/src/version.c Sun Apr 4 16:35:39 2004
174 --- src/version.c Mon Apr 5 19:39:04 2004
178 { /* Add new patch number below this line */
184 In his lifetime van Gogh painted 486 oil paintings. Oddly enough, 8975
185 of them are to be found in the United States.
187 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
188 /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
189 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
190 \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
193 Error:015 - Unable to exit Windows. Try the door.
195 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
196 /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
197 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
198 \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///