changeset 2704:114400ea911b

[xemacs-hg @ 2005-03-31 14:56:37 by aidan] Fix Unicode conversion for control-1, prevent a segfault with set-unicode-conversion.
author aidan
date Thu, 31 Mar 2005 14:56:48 +0000
parents 2f2d12f4f93a
children 2b621542ba7a
files src/ChangeLog src/unicode.c
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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  <kehoea@parhasard.net>
+
+	* 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  <kehoea@parhasard.net>
 
 	* event-Xt.c: Declare Funicode_to_char. 
--- 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
 		{