summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2019-09-18 10:05:09 +0000
committerIan C <ianc@noddybox.co.uk>2019-09-18 10:05:09 +0000
commitc8aa7d7d247b349ba4149951e50817d3f079c8ce (patch)
treef634f107d5571192717f7a73c264be291b65ad45
parentf86e95977b6ccedd64f3094f1099a439eff68020 (diff)
Changed printable test to isascii test in insertbom.
Changed code page in ansi2unicode.
-rwxr-xr-xansi2unicode.sh7
-rw-r--r--insertbom.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/ansi2unicode.sh b/ansi2unicode.sh
index bb8e0fb..8a571d4 100755
--- a/ansi2unicode.sh
+++ b/ansi2unicode.sh
@@ -10,7 +10,12 @@ if [ -z "$1" ] ; then
exit 1
fi
-FROM=CP1252
+# Spanish
+#FROM=CP1252
+
+# Chinese (simplified)
+FROM=CP936
+
TO=UTF-16LE
for i in $@ ; do
diff --git a/insertbom.c b/insertbom.c
index 7d45fae..0f0298c 100644
--- a/insertbom.c
+++ b/insertbom.c
@@ -39,7 +39,7 @@ static void Handle(const char *name)
return;
}
- if (buff[0] == 0 && isprint(buff[1]))
+ if (buff[0] == 0 && isascii(buff[1]))
{
printf("%s: Guessing BE UTF-16\n", name);
write = 1;
@@ -47,7 +47,7 @@ static void Handle(const char *name)
buff[0] = 0xfe;
buff[1] = 0xff;
}
- else if (buff[1] == 0 && isprint(buff[0]))
+ else if (buff[1] == 0 && isascii(buff[0]))
{
printf("%s: Guessing LE UTF-16\n", name);
write = 1;