From 193e4db6b92418318b351d358c37c448d2cfad05 Mon Sep 17 00:00:00 2001 From: tomo Date: Sat, 11 Sep 1999 09:51:51 +0000 Subject: [PATCH] (char_encode_shift_jis): Use table `ucs_to_latin_jisx0201' and BREAKUP_CHAR. --- src/text-coding.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/text-coding.c b/src/text-coding.c index f505c0e..1e12bd4 100644 --- a/src/text-coding.c +++ b/src/text-coding.c @@ -2979,28 +2979,37 @@ char_encode_shift_jis (struct encoding_stream *str, Emchar ch, if (eol_type != EOL_CR) Dynarr_add (dst, ch); } - else if (ch <= 0x7f) - Dynarr_add (dst, ch); - else if (ch == 0xA5) - Dynarr_add (dst, 0x5C); - else if (ch == 0X203E) - Dynarr_add (dst, 0x7E); else { Lisp_Object charset; unsigned int c1, c2, s1, s2; - - BREAKUP_CHAR (ch, charset, c1, c2); + +#ifdef UTF2000 + if ( (c1 = get_byte_from_character_table (ch, ucs_to_latin_jisx0201)) ) + { + charset = Vcharset_latin_jisx0201; + c2 = 0; + } + else +#endif + BREAKUP_CHAR (ch, charset, c1, c2); + if (EQ(charset, Vcharset_katakana_jisx0201)) { Dynarr_add (dst, c1 | 0x80); } + else if (c2 == 0) + { + Dynarr_add (dst, c1); + } else if (EQ(charset, Vcharset_japanese_jisx0208)) { ENCODE_SJIS (c1 | 0x80, c2 | 0x80, s1, s2); Dynarr_add (dst, s1); Dynarr_add (dst, s2); } + else + Dynarr_add (dst, '?'); } } -- 1.7.10.4