Mercurial > emacs
changeset 72576:b09e6c8f23d4
(mac-string-to-utxt): If adjustment for MacJapanese
results in ASCII-only string, encode original one directly.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Wed, 30 Aug 2006 08:51:28 +0000 |
parents | 2cc5d85e63a1 |
children | 546f5ad61050 |
files | lisp/term/mac-win.el |
diffstat | 1 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/term/mac-win.el Tue Aug 29 22:17:05 2006 +0000 +++ b/lisp/term/mac-win.el Wed Aug 30 08:51:28 2006 +0000 @@ -1287,14 +1287,19 @@ (find-coding-systems-string string))) (setq coding-system (coding-system-change-eol-conversion coding-system 'mac)) - (when (and (eq system-type 'darwin) - (eq coding-system 'japanese-shift-jis-mac)) - (setq encoding mac-text-encoding-mac-japanese-basic-variant) - (setq string (subst-char-in-string ?\\ ?\x80 string)) - (subst-char-in-string ?\¥ ?\x5c string t)) - (setq data (mac-code-convert-string - (encode-coding-string string coding-system) - (or encoding coding-system) nil))) + (let ((str string)) + (when (and (eq system-type 'darwin) + (eq coding-system 'japanese-shift-jis-mac)) + (setq encoding mac-text-encoding-mac-japanese-basic-variant) + (setq str (subst-char-in-string ?\\ ?\x80 str)) + (subst-char-in-string ?\¥ ?\x5c str t) + ;; ASCII-only? + (if (string-match "\\`[\x00-\x7f]*\\'" str) + (setq str nil))) + (and str + (setq data (mac-code-convert-string + (encode-coding-string str coding-system) + (or encoding coding-system) nil))))) (or data (encode-coding-string string (if (eq (byteorder) ?B) 'utf-16be-mac 'utf-16le-mac)))))