changeset 11968:3a1043b2e1f9 draft

(svn r16374) -Fix (r11622): Valid UTF-8 sequences between 0x20 and 0xFF should be allowed as is instead of being treated as control codes.
author peter1138 <peter1138@openttd.org>
date Fri, 22 May 2009 12:05:28 +0000
parents 8f2520911121
children d89c33df9b66
files src/newgrf_text.cpp
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -120,7 +120,13 @@
 		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++;
 		}