# HG changeset patch # User Kenichi Handa # Date 1042764478 0 # Node ID 7ec1335b6d3697cfbe8cab1069991cab616707cf # Parent 84c362631906b47ef5e1b1467d0fba37ee570dac (Fformat): Convert an unibyte char argument that is formatted by "%c" to multibyte if the total result must be a multibyte string. diff -r 84c362631906 -r 7ec1335b6d36 src/editfns.c --- a/src/editfns.c Fri Jan 17 00:47:32 2003 +0000 +++ b/src/editfns.c Fri Jan 17 00:47:58 2003 +0000 @@ -3359,17 +3359,25 @@ error ("Invalid format operation %%%c", *format); thissize = 30; - if (*format == 'c' - && (! SINGLE_BYTE_CHAR_P (XINT (args[n])) - || XINT (args[n]) == 0)) + if (*format == 'c') { - if (! multibyte) + if (! SINGLE_BYTE_CHAR_P (XINT (args[n])) + || XINT (args[n]) == 0) { - multibyte = 1; - goto retry; + if (! multibyte) + { + multibyte = 1; + goto retry; + } + args[n] = Fchar_to_string (args[n]); + thissize = SBYTES (args[n]); } - args[n] = Fchar_to_string (args[n]); - thissize = SBYTES (args[n]); + else if (! ASCII_BYTE_P (XINT (args[n])) && multibyte) + { + args[n] + = Fchar_to_string (Funibyte_char_to_multibyte (args[n])); + thissize = SBYTES (args[n]); + } } } else if (FLOATP (args[n]) && *format != 's')