# HG changeset patch # User aidan # Date 1112281008 0 # Node ID 114400ea911b1bca0baf6073ab2fb045d894a4ff # Parent 2f2d12f4f93accda75ef05c3d6506d9b34d66499 [xemacs-hg @ 2005-03-31 14:56:37 by aidan] Fix Unicode conversion for control-1, prevent a segfault with set-unicode-conversion. diff -r 2f2d12f4f93a -r 114400ea911b src/ChangeLog --- a/src/ChangeLog Thu Mar 31 11:28:44 2005 +0000 +++ b/src/ChangeLog Thu Mar 31 14:56:48 2005 +0000 @@ -1,3 +1,13 @@ +2005-03-31 Aidan Kehoe + + * unicode.c (set_unicode_conversion): Don't try to write to the + non-existent conversion tables for ASCII and control-1, in the + interest of not segfaulting. + * unicode.c (unicode_convert): The "position code" for a control-1 + character has #xA0 added to it when encoded in Mule, unlike #x80 + for all the other non-ASCII character sets ; take this into + account. + 2005-03-29 Aidan Kehoe * event-Xt.c: Declare Funicode_to_char. diff -r 2f2d12f4f93a -r 114400ea911b src/unicode.c --- a/src/unicode.c Thu Mar 31 11:28:44 2005 +0000 +++ b/src/unicode.c Thu Mar 31 14:56:48 2005 +0000 @@ -857,6 +857,9 @@ sledgehammer_check_unicode_tables (charset); #endif + if (EQ(charset, Vcharset_ascii) || EQ(charset, Vcharset_control_1)) + return; + /* First, the char -> unicode translation */ if (XCHARSET_DIMENSION (charset) == 1) @@ -1921,7 +1924,13 @@ { /* Processing Non-ASCII character */ char_boundary = 1; if (EQ (charset, Vcharset_control_1)) - encode_unicode_char (Vcharset_control_1, c, 0, dst, + /* See: + + (Info-goto-node "(internals)Internal String Encoding") + + for the rationale behind subtracting #xa0 from the + character's code. */ + encode_unicode_char (Vcharset_control_1, c - 0xa0, 0, dst, type, little_endian); else {