From http://www.jwz.org/xscreensaver/xscreensaver-5.32.tar.gz
[xscreensaver] / utils / utf8wc.c
index e2db24170aadecef6caa7992e3fe402a5f90c08d..ba6806f602fd54a3e223d5cdba34ff3b5e9dbeb4 100644 (file)
@@ -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 = ' ';      /* &nbsp; */
 
       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. */
         {