changeset 88947:894b8bce3208

(Funibyte_char_to_multibyte): If C can't be decoded by the primary charset, make it eight-bit char. (Fmultibyte_char_to_unibyte): Call CHAR_TO_BYTE8.
author Kenichi Handa <handa@m17n.org>
date Wed, 31 Jul 2002 07:06:36 +0000
parents 233c080b5756
children 1ff7f42f40ad
files src/character.c
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/character.c	Wed Jul 31 07:05:33 2002 +0000
+++ b/src/character.c	Wed Jul 31 07:06:36 2002 +0000
@@ -247,7 +247,7 @@
   charset = CHARSET_FROM_ID (charset_primary);
   c = DECODE_CHAR (charset, c);
   if (c < 0)
-    error ("Can't convert to multibyte character: %d", XINT (ch));
+    c = BYTE8_TO_CHAR (XFASTINT (ch));
   return make_number (c);
 }
 
@@ -260,17 +260,12 @@
      Lisp_Object ch;
 {
   int c;
-  unsigned code;
   struct charset *charset;
 
   CHECK_CHARACTER (ch);
   c = XFASTINT (ch);
-  charset = CHARSET_FROM_ID (charset_primary);
-  code = ENCODE_CHAR (charset, c);
-  if (code < CHARSET_MIN_CODE (charset)
-      || code > CHARSET_MAX_CODE (charset))
-    error ("Can't convert to unibyte character: %d", XINT (ch));
-  return make_number (code);
+  c = CHAR_TO_BYTE8 (c);
+  return make_number (c);
 }
 
 DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,