aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/character.c11
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
276DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, 271DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,