From fd6f711b51c82dc0d72c9288af5e3f5bab841979 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 7 Sep 2000 13:01:44 +0000 Subject: [PATCH] (detect_coding_sjis): Check the byte sequence more regidly. --- src/ChangeLog | 5 +++++ src/coding.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ba1be956858..73a27f79083 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,9 +1,14 @@ 2000-09-07 Kenichi Handa + * charset.h (MIN_CHARSET_OFFICIAL_DIMENSION1): Define it as 0x80, + not 0x81. + (MIN_CHAR_OFFICIAL_DIMENSION1): Define it as ((0x81 - 0x70) << 7). + * coding.c (encode_coding_sjis_big5): Use translation table for encoding, not decoding. Fix the handling of latin-jisx0201. Check for the charset katakana-jisx0201 too. (ONE_MORE_CHAR): Call translate_char with CHARSET arg -1. + (detect_coding_sjis): Check the byte sequence more regidly. 2000-09-07 Gerd Moellmann diff --git a/src/coding.c b/src/coding.c index 366cf6647a7..fa079a749cb 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2266,10 +2266,15 @@ detect_coding_sjis (src, src_end) while (1) { ONE_MORE_BYTE (c); - if ((c >= 0x80 && c < 0xA0) || c >= 0xE0) + if (c >= 0x81) { - ONE_MORE_BYTE (c); - if (c < 0x40) + if (c <= 0x9F || (c >= 0xE0 && c <= 0xEF)) + { + ONE_MORE_BYTE (c); + if (c < 0x40 || c == 0x7F || c > 0xFC) + return 0; + } + else if (c > 0xDF) return 0; } } -- 2.39.5