Mercurial > emacs
changeset 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 | 84c362631906 |
children | fc85fba774da |
files | src/editfns.c |
diffstat | 1 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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')