summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2010-01-15 21:35:31 +0900
committerKenichi Handa <handa@m17n.org>2010-01-15 21:35:31 +0900
commitca4f0e9a63044c442a2bc884ee4c96229bb0742c (patch)
treeaf6f3153633c6fe79cff4cad1d5c127551d3deac
parentd12bd91784f39bc65d9fdccc00676778f035c79d (diff)
downloademacs-ca4f0e9a63044c442a2bc884ee4c96229bb0742c.tar.gz
emacs-ca4f0e9a63044c442a2bc884ee4c96229bb0742c.tar.bz2
emacs-ca4f0e9a63044c442a2bc884ee4c96229bb0742c.zip
international/mule-cmds.el (canonicalize-coding-system-name): Convert "msXXX", "ibmXXX", "windows-XXX" to "cpXXX".
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/international/mule-cmds.el29
2 files changed, 21 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2b14d89c325..1f3e01fddb2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-15 Kenichi Handa <handa@m17n.org>
+
+ * international/mule-cmds.el (canonicalize-coding-system-name):
+ Convert "msXXX", "ibmXXX", "windows-XXX" to "cpXXX".
+
2010-01-14 Glenn Morris <rgm@gnu.org>
* frame.el (show-trailing-whitespace): Safe if boolean. (Bug#5312)
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index c21bfb23ba9..a594b837e0b 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -226,19 +226,22 @@ how text is formatted automatically while decoding."
;; and delimiter characters. Support function of
;; coding-system-from-name.
(defun canonicalize-coding-system-name (name)
- (if (string-match "^iso[-_ ]?[0-9]" name)
- ;; "iso-8859-1" -> "8859-1", "iso-2022-jp" ->"2022-jp"
- (setq name (substring name (1- (match-end 0)))))
- (let ((idx (string-match "[-_ /]" name)))
- ;; Delete "-", "_", " ", "/" but do distinguish "16-be" and "16be".
- (while idx
- (if (and (>= idx 2)
- (eq (string-match "16-[lb]e$" name (- idx 2))
- (- idx 2)))
- (setq idx (string-match "[-_ /]" name (match-end 0)))
- (setq name (concat (substring name 0 idx) (substring name (1+ idx)))
- idx (string-match "[-_ /]" name idx))))
- name))
+ (if (string-match "^\\(ms\\|ibm\\|windows-\\)\\([0-9]+\\)$" name)
+ ;; "ms950", "ibm950", "windows-950" -> "cp950"
+ (concat "cp" (match-string 2 name))
+ (if (string-match "^iso[-_ ]?[0-9]" name)
+ ;; "iso-8859-1" -> "8859-1", "iso-2022-jp" ->"2022-jp"
+ (setq name (substring name (1- (match-end 0)))))
+ (let ((idx (string-match "[-_ /]" name)))
+ ;; Delete "-", "_", " ", "/" but do distinguish "16-be" and "16be".
+ (while idx
+ (if (and (>= idx 2)
+ (eq (string-match "16-[lb]e$" name (- idx 2))
+ (- idx 2)))
+ (setq idx (string-match "[-_ /]" name (match-end 0)))
+ (setq name (concat (substring name 0 idx) (substring name (1+ idx)))
+ idx (string-match "[-_ /]" name idx))))
+ name)))
(defun coding-system-from-name (name)
"Return a coding system whose name matches with NAME (string or symbol)."