diff options
| author | Kenichi Handa | 2002-07-31 07:06:36 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-07-31 07:06:36 +0000 |
| commit | 3c5a53bdceac9d8b81afdee50b6b9098ef5ec094 (patch) | |
| tree | ee9b27f4d5b7de0cd037b3a5a28c6cfe1a2d117d /src | |
| parent | 8bc28f69bac6280a3b33ecffebe93c5d7b67b4ad (diff) | |
| download | emacs-3c5a53bdceac9d8b81afdee50b6b9098ef5ec094.tar.gz emacs-3c5a53bdceac9d8b81afdee50b6b9098ef5ec094.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/character.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/character.c b/src/character.c index 5907f55b1f3..6e2b28a495f 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -247,7 +247,7 @@ the current primary charset (value of `charset-primary'). */) | |||
| 247 | charset = CHARSET_FROM_ID (charset_primary); | 247 | charset = CHARSET_FROM_ID (charset_primary); |
| 248 | c = DECODE_CHAR (charset, c); | 248 | c = DECODE_CHAR (charset, c); |
| 249 | if (c < 0) | 249 | if (c < 0) |
| 250 | error ("Can't convert to multibyte character: %d", XINT (ch)); | 250 | c = BYTE8_TO_CHAR (XFASTINT (ch)); |
| 251 | return make_number (c); | 251 | return make_number (c); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| @@ -260,17 +260,12 @@ the current primary charset (value of `charset-primary'). */) | |||
| 260 | Lisp_Object ch; | 260 | Lisp_Object ch; |
| 261 | { | 261 | { |
| 262 | int c; | 262 | int c; |
| 263 | unsigned code; | ||
| 264 | struct charset *charset; | 263 | struct charset *charset; |
| 265 | 264 | ||
| 266 | CHECK_CHARACTER (ch); | 265 | CHECK_CHARACTER (ch); |
| 267 | c = XFASTINT (ch); | 266 | c = XFASTINT (ch); |
| 268 | charset = CHARSET_FROM_ID (charset_primary); | 267 | c = CHAR_TO_BYTE8 (c); |
| 269 | code = ENCODE_CHAR (charset, c); | 268 | return make_number (c); |
| 270 | if (code < CHARSET_MIN_CODE (charset) | ||
| 271 | || code > CHARSET_MAX_CODE (charset)) | ||
| 272 | error ("Can't convert to unibyte character: %d", XINT (ch)); | ||
| 273 | return make_number (code); | ||
| 274 | } | 269 | } |
| 275 | 270 | ||
| 276 | DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, | 271 | DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, |