diff options
| author | Karl Heuer | 1998-01-18 04:51:16 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-01-18 04:51:16 +0000 |
| commit | 974a6ff52fadfb760a2c291de5137ea3f9d64844 (patch) | |
| tree | 991424fc2eb40286ae26b0e3676622b61936dc29 /src | |
| parent | e7fc914b0244b9b7488a0e4160210b76f4dc918e (diff) | |
| download | emacs-974a6ff52fadfb760a2c291de5137ea3f9d64844.tar.gz emacs-974a6ff52fadfb760a2c291de5137ea3f9d64844.zip | |
(print) <Lisp_String>: When multibyte is enabled, print
single-byte non-ASCII chars using octal escapes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c index 038e6ff3d15..0d2a29cc5c1 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1149,8 +1149,8 @@ print (obj, printcharfun, escapeflag) | |||
| 1149 | PRINTCHAR ('\\'); | 1149 | PRINTCHAR ('\\'); |
| 1150 | PRINTCHAR ('f'); | 1150 | PRINTCHAR ('f'); |
| 1151 | } | 1151 | } |
| 1152 | else if (! SINGLE_BYTE_CHAR_P (c) | 1152 | else if ((! SINGLE_BYTE_CHAR_P (c) |
| 1153 | && NILP (current_buffer->enable_multibyte_characters)) | 1153 | && NILP (current_buffer->enable_multibyte_characters))) |
| 1154 | { | 1154 | { |
| 1155 | /* When multibyte is disabled, | 1155 | /* When multibyte is disabled, |
| 1156 | print multibyte string chars using hex escapes. */ | 1156 | print multibyte string chars using hex escapes. */ |
| @@ -1158,6 +1158,17 @@ print (obj, printcharfun, escapeflag) | |||
| 1158 | sprintf (outbuf, "\\x%x", c); | 1158 | sprintf (outbuf, "\\x%x", c); |
| 1159 | strout (outbuf, -1, -1, printcharfun, 0); | 1159 | strout (outbuf, -1, -1, printcharfun, 0); |
| 1160 | } | 1160 | } |
| 1161 | else if (SINGLE_BYTE_CHAR_P (c) | ||
| 1162 | && ! ASCII_BYTE_P (c) | ||
| 1163 | && ! NILP (current_buffer->enable_multibyte_characters)) | ||
| 1164 | { | ||
| 1165 | /* When multibyte is enabled, | ||
| 1166 | print single-byte non-ASCII string chars | ||
| 1167 | using octal escapes. */ | ||
| 1168 | unsigned char outbuf[5]; | ||
| 1169 | sprintf (outbuf, "\\%03o", c); | ||
| 1170 | strout (outbuf, -1, -1, printcharfun, 0); | ||
| 1171 | } | ||
| 1161 | else | 1172 | else |
| 1162 | { | 1173 | { |
| 1163 | if (c == '\"' || c == '\\') | 1174 | if (c == '\"' || c == '\\') |