Commit 8c9d55a9 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(encode-coding-char): An ASCII character is always encodable.

parent 24dad5d5
......@@ -1824,7 +1824,7 @@ It can be retrieved with `(get-char-code-property CHAR PROPNAME)'."
"Return a pretty description of STR that is encoded by CODING-SYSTEM."
(setq str (string-as-unibyte str))
(if (eq (coding-system-type coding-system) 2)
(if (and coding-system (eq (coding-system-type coding-system) 2))
;; Try to get a pretty description for ISO 2022 escape sequences.
(function (lambda (x) (or (cdr (assq x iso-2022-control-alist))
(format "%02X" x))))
......@@ -1838,9 +1838,11 @@ If CODING-SYSTEM can't safely encode CHAR, return nil."
(str2 (make-string 2 char))
(safe-charsets (and coding-system
(coding-system-get coding-system 'safe-charsets)))
(charset (char-charset char))
enc1 enc2 i1 i2)
(when (or (eq safe-charsets t)
(memq (char-charset char) safe-charsets))
(eq charset 'ascii)
(memq charset safe-charsets))
;; We must find the encoded string of CHAR. But, just encoding
;; CHAR will put extra control sequences (usually to designate
;; ASCII charaset) at the tail if type of CODING is ISO 2022.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment