Mercurial > emacs
changeset 51140:94d903190cee
(ENCODE_UNSAFE_CHARACTER): Adjusted for the name change
of CODING_REPLACEMENT_CHARACTER.
(decode_coding_iso2022): If CODING_FLAG_ISO_SAFE, set
CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag in coding->mode, and
check this flag on encoding.
(encode_coding_sjis_big5): Check
CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag of coding->mode.
(Fset_terminal_coding_system_internal): Set
CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag in terminal_coding.mode
instead of setting CODING_FLAG_ISO_SAFE flag in
terminal_coding.flags.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 22 May 2003 05:53:23 +0000 |
parents | 3d3ffeef8c92 |
children | 45b44457e685 |
files | src/coding.c |
diffstat | 1 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/coding.c Thu May 22 05:52:15 2003 +0000 +++ b/src/coding.c Thu May 22 05:53:23 2003 +0000 @@ -2301,11 +2301,11 @@ /* Instead of encoding character C, produce one or two `?'s. */ -#define ENCODE_UNSAFE_CHARACTER(c) \ - do { \ - ENCODE_ISO_CHARACTER (CODING_INHIBIT_CHARACTER_SUBSTITUTION); \ - if (CHARSET_WIDTH (CHAR_CHARSET (c)) > 1) \ - ENCODE_ISO_CHARACTER (CODING_INHIBIT_CHARACTER_SUBSTITUTION); \ +#define ENCODE_UNSAFE_CHARACTER(c) \ + do { \ + ENCODE_ISO_CHARACTER (CODING_REPLACEMENT_CHARACTER); \ + if (CHARSET_WIDTH (CHAR_CHARSET (c)) > 1) \ + ENCODE_ISO_CHARACTER (CODING_REPLACEMENT_CHARACTER); \ } while (0) @@ -2534,6 +2534,9 @@ Lisp_Object translation_table; Lisp_Object safe_chars; + if (coding->flags & CODING_FLAG_ISO_SAFE) + coding->mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR; + safe_chars = coding_safe_chars (coding->symbol); if (NILP (Venable_character_translation)) @@ -2601,7 +2604,7 @@ } else { - if (coding->flags & CODING_FLAG_ISO_SAFE + if (coding->mode & CODING_MODE_INHIBIT_UNENCODABLE_CHAR && ! CODING_SAFE_CHAR_P (safe_chars, c)) ENCODE_UNSAFE_CHARACTER (c); else @@ -2670,7 +2673,7 @@ *dst++ = c; coding->errors++; } - else if (coding->flags & CODING_FLAG_ISO_SAFE + else if (coding->mode & CODING_MODE_INHIBIT_UNENCODABLE_CHAR && ! CODING_SAFE_CHAR_P (safe_chars, c)) ENCODE_UNSAFE_CHARACTER (c); else @@ -3113,6 +3116,12 @@ EMIT_ONE_BYTE (c1 | 0x80); else if (charset == charset_latin_jisx0201) EMIT_ONE_BYTE (c1); + else if (coding->mode & CODING_MODE_INHIBIT_UNENCODABLE_CHAR) + { + EMIT_ONE_BYTE (CODING_REPLACEMENT_CHARACTER); + if (CHARSET_WIDTH (charset) > 1) + EMIT_ONE_BYTE (CODING_REPLACEMENT_CHARACTER); + } else /* There's no way other than producing the internal codes as is. */ @@ -3125,6 +3134,12 @@ ENCODE_BIG5 (charset, c1, c2, c1, c2); EMIT_TWO_BYTES (c1, c2); } + else if (coding->mode & CODING_MODE_INHIBIT_UNENCODABLE_CHAR) + { + EMIT_ONE_BYTE (CODING_REPLACEMENT_CHARACTER); + if (CHARSET_WIDTH (charset) > 1) + EMIT_ONE_BYTE (CODING_REPLACEMENT_CHARACTER); + } else /* There's no way other than producing the internal codes as is. */ @@ -7023,7 +7038,7 @@ CHECK_SYMBOL (coding_system); setup_coding_system (Fcheck_coding_system (coding_system), &terminal_coding); /* We had better not send unsafe characters to terminal. */ - terminal_coding.flags |= CODING_FLAG_ISO_SAFE; + terminal_coding.mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR; /* Character composition should be disabled. */ terminal_coding.composing = COMPOSITION_DISABLED; /* Error notification should be suppressed. */