(svn r16374) -Fix (r11622): Valid UTF-8 sequences between 0x20 and 0xFF should be allowed as is instead of being treated as control codes.

This commit is contained in:
peter1138 2009-05-22 12:05:28 +00:00
parent 6afce484bb
commit b37fda664c
1 changed files with 7 additions and 1 deletions

View File

@ -120,7 +120,13 @@ char *TranslateTTDPatchCodes(uint32 grfid, const char *str)
if (unicode && Utf8EncodedCharLen(*str) != 0) {
c = Utf8Consume(&str);
/* 'Magic' range of control codes. */
if (GB(c, 8, 8) == 0xE0) c = GB(c, 0, 8);
if (GB(c, 8, 8) == 0xE0) {
c = GB(c, 0, 8);
} else if (c >= 0x20) {
if (!IsValidChar(c, CS_ALPHANUMERAL)) c = '?';
d += Utf8Encode(d, c);
continue;
}
} else {
c = (byte)*str++;
}