# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1156927888 0 # Node ID b09e6c8f23d401b45d12d786fdf5da87f096abac # Parent 2cc5d85e63a1a9c5027127fd3a2ca650b58c8ab6 (mac-string-to-utxt): If adjustment for MacJapanese results in ASCII-only string, encode original one directly. diff -r 2cc5d85e63a1 -r b09e6c8f23d4 lisp/term/mac-win.el --- 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)))))