From a1727f64c6975d2fea0de2caf386bfddcf0cf3a7 Mon Sep 17 00:00:00 2001 From: Bill Lash Date: Sat, 27 Apr 2019 21:24:03 -0500 Subject: [PATCH] Add utf-8 output to script file --- src/common/files.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/common/files.c b/src/common/files.c index 676c0dd..ff8cb4d 100644 --- a/src/common/files.c +++ b/src/common/files.c @@ -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 */ -- 2.34.1