From: tomo Date: Sat, 21 Jul 2001 03:41:08 +0000 (+0000) Subject: (decode_builtin_char): Check Big5 code range which can be mapped to X-Git-Tag: r21-2-38-utf-2000-0_17-1~279 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=744a042e773ae26289f1cc91fd3d51152d3d779d;p=chise%2Fxemacs-chise.git.1 (decode_builtin_char): Check Big5 code range which can be mapped to `chinese-big5-1' and `chinese-big5-2'. --- diff --git a/src/mule-charset.c b/src/mule-charset.c index b3c7765..bd56719 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -2172,20 +2172,27 @@ decode_builtin_char (Lisp_Object charset, int code_point) { int c1 = code_point >> 8; int c2 = code_point & 0xFF; - unsigned int I - = (c1 - 0xA1) * BIG5_SAME_ROW - + c2 - (c2 < 0x7F ? 0x40 : 0x62); + unsigned int I; - if (c1 < 0xC9) + if ( ( (0xA1 <= c1) && (c1 <= 0xFE) ) + && + ( ((0x40 <= c2) && (c2 <= 0x7E)) || + ((0xA1 <= c2) && (c2 <= 0xFE)) ) ) { - charset = Vcharset_chinese_big5_1; - } - else - { - charset = Vcharset_chinese_big5_2; - I -= (BIG5_SAME_ROW) * (0xC9 - 0xA1); + I = (c1 - 0xA1) * BIG5_SAME_ROW + + c2 - (c2 < 0x7F ? 0x40 : 0x62); + + if (c1 < 0xC9) + { + charset = Vcharset_chinese_big5_1; + } + else + { + charset = Vcharset_chinese_big5_2; + I -= (BIG5_SAME_ROW) * (0xC9 - 0xA1); + } + code_point = ((I / 94 + 33) << 8) | (I % 94 + 33); } - code_point = ((I / 94 + 33) << 8) | (I % 94 + 33); } if ((final = XCHARSET_FINAL (charset)) >= '0') {