Commit bbf12bb3 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(unibyte_char_to_multibyte):

Vnonacii_translation_table will convert a 7-bit charcater.
(multibyte_char_to_unibyte): Handle the case that
Vnonacii_translation_table converts a multibyte charcater to a
unibyte charcter of less than 128.
(init_charset_once): Initialize nonascii_insert_offset and
Vnonacii_translation_table.
parent d4e57bcd
......@@ -329,15 +329,23 @@ int
unibyte_char_to_multibyte (c)
int c;
{
if (c >= 0240 && c < 0400)
if (c < 0400)
{
int c_save = c;
if (! NILP (Vnonascii_translation_table))
c = XINT (Faref (Vnonascii_translation_table, make_number (c)));
else if (nonascii_insert_offset > 0)
c += nonascii_insert_offset;
if (c >= 0240 && (c < 0400 || ! VALID_MULTIBYTE_CHAR_P (c)))
{
c = XINT (Faref (Vnonascii_translation_table, make_number (c)));
if (c >= 0400 && ! VALID_MULTIBYTE_CHAR_P (c))
c = c_save + DEFAULT_NONASCII_INSERT_OFFSET;
}
else if (c >= 0240 && nonascii_insert_offset > 0)
{
c += nonascii_insert_offset;
if (c < 0400 || ! VALID_MULTIBYTE_CHAR_P (c))
c = c_save + DEFAULT_NONASCII_INSERT_OFFSET;
}
else if (c >= 0240)
c = c_save + DEFAULT_NONASCII_INSERT_OFFSET;
}
return c;
......@@ -369,11 +377,16 @@ multibyte_char_to_unibyte (c, rev_tbl)
temp = Faref (rev_tbl, make_number (c));
if (INTEGERP (temp))
c = XINT (temp);
if (c >= 256)
c = (c_save & 0177) + 0200;
}
else
{
if (nonascii_insert_offset > 0)
c -= nonascii_insert_offset;
if (c < 128 || c >= 256)
c = (c_save & 0177) + 0200;
}
else if (nonascii_insert_offset > 0)
c -= nonascii_insert_offset;
if (c < 128 || c >= 256)
c = (c_save & 0177) + 0200;
}
return c;
......@@ -1806,6 +1819,9 @@ init_charset_once ()
val = Fcons (make_number (GENERIC_COMPOSITION_CHAR), val);
Vgeneric_character_list = Fnreverse (val);
}
nonascii_insert_offset = 0;
Vnonascii_translation_table = Qnil;
}
#ifdef emacs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment