comparison src/editfns.c @ 49285:7ec1335b6d36

(Fformat): Convert an unibyte char argument that is formatted by "%c" to multibyte if the total result must be a multibyte string.
author Kenichi Handa <handa@m17n.org>
date Fri, 17 Jan 2003 00:47:58 +0000
parents d5680dc3113e
children 41213ea7b9d6
comparison
equal deleted inserted replaced
49284:84c362631906 49285:7ec1335b6d36
3357 if (*format != 'd' && *format != 'o' && *format != 'x' 3357 if (*format != 'd' && *format != 'o' && *format != 'x'
3358 && *format != 'i' && *format != 'X' && *format != 'c') 3358 && *format != 'i' && *format != 'X' && *format != 'c')
3359 error ("Invalid format operation %%%c", *format); 3359 error ("Invalid format operation %%%c", *format);
3360 3360
3361 thissize = 30; 3361 thissize = 30;
3362 if (*format == 'c' 3362 if (*format == 'c')
3363 && (! SINGLE_BYTE_CHAR_P (XINT (args[n]))
3364 || XINT (args[n]) == 0))
3365 { 3363 {
3366 if (! multibyte) 3364 if (! SINGLE_BYTE_CHAR_P (XINT (args[n]))
3365 || XINT (args[n]) == 0)
3367 { 3366 {
3368 multibyte = 1; 3367 if (! multibyte)
3369 goto retry; 3368 {
3369 multibyte = 1;
3370 goto retry;
3371 }
3372 args[n] = Fchar_to_string (args[n]);
3373 thissize = SBYTES (args[n]);
3370 } 3374 }
3371 args[n] = Fchar_to_string (args[n]); 3375 else if (! ASCII_BYTE_P (XINT (args[n])) && multibyte)
3372 thissize = SBYTES (args[n]); 3376 {
3377 args[n]
3378 = Fchar_to_string (Funibyte_char_to_multibyte (args[n]));
3379 thissize = SBYTES (args[n]);
3380 }
3373 } 3381 }
3374 } 3382 }
3375 else if (FLOATP (args[n]) && *format != 's') 3383 else if (FLOATP (args[n]) && *format != 's')
3376 { 3384 {
3377 if (! (*format == 'e' || *format == 'f' || *format == 'g')) 3385 if (! (*format == 'e' || *format == 'f' || *format == 'g'))