X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=utils%2Futf8wc.c;fp=utils%2Futf8wc.c;h=ba6806f602fd54a3e223d5cdba34ff3b5e9dbeb4;hp=e2db24170aadecef6caa7992e3fe402a5f90c08d;hb=7edd66e6bd3209013ee059819747b10b5835635b;hpb=d5186197bc394e10a4402f7f6d23fbb14103bc50 diff --git a/utils/utf8wc.c b/utils/utf8wc.c index e2db2417..ba6806f6 100644 --- a/utils/utf8wc.c +++ b/utils/utf8wc.c @@ -342,7 +342,11 @@ utf8_to_latin1 (const char *string, Bool ascii_p) long len2 = utf8_decode (in, in_end - in, &uc); in += len2; - if (uc > 0xFF) + if (uc == '\240') /*   */ + uc = ' '; + else if (uc >= 0x2300 && uc <= 0x36F) + uc = 0; /* Discard "Unicode Combining Diacriticals Block" */ + else if (uc > 0xFF) switch (uc) { /* Map "Unicode General Punctuation Block" to Latin1 equivalents. */ @@ -403,15 +407,11 @@ utf8_to_latin1 (const char *string, Bool ascii_p) default: break; } - else if (uc >= 0x2300 && uc <= 0x36F) - uc = 0; /* Discard "Unicode Combining Diacriticals Block" */ - else if (uc == '\240') - uc = ' '; /*   */ if (uc > 0xFF) /* "Inverted question mark" looks enough like 0xFFFD, the "Unicode Replacement Character". */ - uc = (ascii_p ? '#' : 0xBF); + uc = (ascii_p ? '#' : '\277'); if (ascii_p) /* Map Latin1 to the closest ASCII versions. */ {