diff options
Diffstat (limited to 'src/print.c')
| -rw-r--r-- | src/print.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c index 420e6f55b4c..269d8f250e2 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Lisp object printing and output streams. | 1 | /* Lisp object printing and output streams. |
| 2 | 2 | ||
| 3 | Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2015 Free Software | 3 | Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2016 Free Software |
| 4 | Foundation, Inc. | 4 | Foundation, Inc. |
| 5 | 5 | ||
| 6 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| @@ -200,6 +200,13 @@ printchar_to_stream (unsigned int ch, FILE *stream) | |||
| 200 | { | 200 | { |
| 201 | Lisp_Object dv IF_LINT (= Qnil); | 201 | Lisp_Object dv IF_LINT (= Qnil); |
| 202 | ptrdiff_t i = 0, n = 1; | 202 | ptrdiff_t i = 0, n = 1; |
| 203 | Lisp_Object coding_system = Vlocale_coding_system; | ||
| 204 | bool encode_p = false; | ||
| 205 | |||
| 206 | if (!NILP (Vcoding_system_for_write)) | ||
| 207 | coding_system = Vcoding_system_for_write; | ||
| 208 | if (!NILP (coding_system)) | ||
| 209 | encode_p = true; | ||
| 203 | 210 | ||
| 204 | if (CHAR_VALID_P (ch) && DISP_TABLE_P (Vstandard_display_table)) | 211 | if (CHAR_VALID_P (ch) && DISP_TABLE_P (Vstandard_display_table)) |
| 205 | { | 212 | { |
| @@ -228,8 +235,11 @@ printchar_to_stream (unsigned int ch, FILE *stream) | |||
| 228 | unsigned char mbstr[MAX_MULTIBYTE_LENGTH]; | 235 | unsigned char mbstr[MAX_MULTIBYTE_LENGTH]; |
| 229 | int len = CHAR_STRING (ch, mbstr); | 236 | int len = CHAR_STRING (ch, mbstr); |
| 230 | Lisp_Object encoded_ch = | 237 | Lisp_Object encoded_ch = |
| 231 | ENCODE_SYSTEM (make_multibyte_string ((char *) mbstr, 1, len)); | 238 | make_multibyte_string ((char *) mbstr, 1, len); |
| 232 | 239 | ||
| 240 | if (encode_p) | ||
| 241 | encoded_ch = code_convert_string_norecord (encoded_ch, | ||
| 242 | coding_system, true); | ||
| 233 | fwrite (SSDATA (encoded_ch), 1, SBYTES (encoded_ch), stream); | 243 | fwrite (SSDATA (encoded_ch), 1, SBYTES (encoded_ch), stream); |
| 234 | #ifdef WINDOWSNT | 244 | #ifdef WINDOWSNT |
| 235 | if (print_output_debug_flag && stream == stderr) | 245 | if (print_output_debug_flag && stream == stderr) |