diff options
| author | Kenichi Handa | 2003-01-17 00:47:58 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-01-17 00:47:58 +0000 |
| commit | 063b53b1b0b2c1e17975803159455ed4bd1bb585 (patch) | |
| tree | 4eebe6b55d4b40d38b11ec2ec1c7b553202218f0 /src | |
| parent | 1255b58ae9bbc3d9c8d6f426ec22facbc307fa04 (diff) | |
| download | emacs-063b53b1b0b2c1e17975803159455ed4bd1bb585.tar.gz emacs-063b53b1b0b2c1e17975803159455ed4bd1bb585.zip | |
(Fformat): Convert an unibyte char argument that is
formatted by "%c" to multibyte if the total result must be a
multibyte string.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/editfns.c b/src/editfns.c index 6539cd11d45..28c97c11a6b 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3359,17 +3359,25 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 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]); | ||
| 3374 | } | ||
| 3375 | else if (! ASCII_BYTE_P (XINT (args[n])) && multibyte) | ||
| 3376 | { | ||
| 3377 | args[n] | ||
| 3378 | = Fchar_to_string (Funibyte_char_to_multibyte (args[n])); | ||
| 3379 | thissize = SBYTES (args[n]); | ||
| 3370 | } | 3380 | } |
| 3371 | args[n] = Fchar_to_string (args[n]); | ||
| 3372 | thissize = SBYTES (args[n]); | ||
| 3373 | } | 3381 | } |
| 3374 | } | 3382 | } |
| 3375 | else if (FLOATP (args[n]) && *format != 's') | 3383 | else if (FLOATP (args[n]) && *format != 's') |