From d8304b0e6f24cb622fe8e06331f0db9acc42619d Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Thu, 6 Feb 2020 21:54:35 -0800 Subject: [PATCH] Fix bug (?) in utf2sjis Don't generate SJIS with initial byte 0x80. I'm guessing that sjis2utf handles initial byte 0x80 the way it does for compatibility reasons, but there is no reason for utf2sjis to generate this coding. --- src/utfsjis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utfsjis.c b/src/utfsjis.c index e0cd50d..486e363 100644 --- a/src/utfsjis.c +++ b/src/utfsjis.c @@ -81,7 +81,7 @@ char *sjis2utf(const char *_src, size_t len) { } static int unicode_to_sjis(int u) { - for (int b1 = 0x80; b1 <= 0xff; b1++) { + for (int b1 = 0x81; b1 <= 0xff; b1++) { if (b1 >= 0xa0 && b1 <= 0xdf) continue; for (int b2 = 0x40; b2 <= 0xff; b2++) {