Add utf-8 output to script file
authorBill Lash <william.lash@gmail.com>
Sun, 28 Apr 2019 02:24:03 +0000 (21:24 -0500)
committerDavid Griffith <dave@661.org>
Sun, 5 May 2019 00:36:24 +0000 (17:36 -0700)
src/common/files.c

index 676c0ddfb18e3a84c1ce178d5249bb8c8db2534d..ff8cb4dd3d3a6afd8034b6171342b35fe0b282af 100644 (file)
@@ -159,7 +159,33 @@ void script_char (zchar c)
        c = latin1_to_ibm[c - ZC_LATIN1_MIN];
 #endif
 
-    fputc (c, sfp); script_width++;
+#ifdef USE_UTF8
+    if (c >= ZC_LATIN1_MIN)
+    {
+      if ( c < 0xc0) {
+       fputc (0xc2, sfp); 
+       fputc (c, sfp);
+#ifdef HANDLE_OE_DIPTHONG
+      } else if (c == 0xd6) {
+       fputc (0xc5, sfp);
+       fputc (0x92, sfp);
+      } else if (c == 0xf6) {
+       fputc (0xc5, sfp);
+       fputc (0x93, sfp);
+#endif /* HANDLE_OE_DIPTHONG */
+      } else {
+       fputc (0xc3, sfp);
+       fputc (c - 0x40, sfp);
+      }
+    }
+    else
+    {
+       fputc (c, sfp);
+    }
+#else
+    fputc (c, sfp);
+#endif
+    script_width++;
 
 }/* script_char */