changeset 106853:2643225473f7

international/mule-cmds.el (canonicalize-coding-system-name): Convert "msXXX", "ibmXXX", "windows-XXX" to "cpXXX".
author Kenichi Handa <handa@m17n.org>
date Fri, 15 Jan 2010 21:52:50 +0900
parents fd03fa91837d (current diff) a12fbed3d106 (diff)
children 28877d9cc2e1 b86e6346b4a8 c5b62c5789d8
files
diffstat 2 files changed, 21 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jan 15 14:14:00 2010 +0900
+++ b/lisp/ChangeLog	Fri Jan 15 21:52:50 2010 +0900
@@ -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-15  Glenn Morris  <rgm@gnu.org>
 
 	* log-view.el (top-level): Require 'wid-edit.  (Bug#5311)
--- a/lisp/international/mule-cmds.el	Fri Jan 15 14:14:00 2010 +0900
+++ b/lisp/international/mule-cmds.el	Fri Jan 15 21:52:50 2010 +0900
@@ -226,19 +226,22 @@
 ;; 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)."