summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/term/mac-win.el21
2 files changed, 18 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b628594097d..d8ec23f04e5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-30 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * term/mac-win.el (mac-string-to-utxt): If adjustment for MacJapanese
+ results in ASCII-only string, encode original one directly.
+
2006-08-29 Romain Francoise <romain@orebokech.com>
* startup.el (normal-splash-screen, fancy-splash-screens): Make
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el
index 538aa09b2c5..20a65976a5c 100644
--- a/lisp/term/mac-win.el
+++ b/lisp/term/mac-win.el
@@ -1287,14 +1287,19 @@ correspoinding TextEncodingBase value."
(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)))))