Fix bug with UTF16 to UTF8 conversion for chars 0x80..0xFF

This commit is contained in:
James Clark 1998-02-02 11:14:46 +00:00
parent c70ed036c9
commit fdad370c5b

View File

@ -256,12 +256,15 @@ void PREFIX(toUtf8)(const ENCODING *enc, \
unsigned char hi = GET_HI(from); \ unsigned char hi = GET_HI(from); \
switch (hi) { \ switch (hi) { \
case 0: \ case 0: \
if (lo < 0x80) { \
if (*toP == toLim) { \ if (*toP == toLim) { \
*fromP = from; \ *fromP = from; \
return; \ return; \
} \ } \
*(*toP)++ = lo; \ *(*toP)++ = lo; \
break; \ break; \
} \
/* fall through */ \
case 0x1: case 0x2: case 0x3: \ case 0x1: case 0x2: case 0x3: \
case 0x4: case 0x5: case 0x6: case 0x7: \ case 0x4: case 0x5: case 0x6: case 0x7: \
if (toLim - *toP < 2) { \ if (toLim - *toP < 2) { \