aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2010-01-15 21:35:31 +0900
committerKenichi Handa2010-01-15 21:35:31 +0900
commitca4f0e9a63044c442a2bc884ee4c96229bb0742c (patch)
treeaf6f3153633c6fe79cff4cad1d5c127551d3deac
parentd12bd91784f39bc65d9fdccc00676778f035c79d (diff)
downloademacs-ca4f0e9a63044c442a2bc884ee4c96229bb0742c.tar.gz
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 @@
12010-01-15 Kenichi Handa <handa@m17n.org>
2
3 * international/mule-cmds.el (canonicalize-coding-system-name):
4 Convert "msXXX", "ibmXXX", "windows-XXX" to "cpXXX".
5
12010-01-14 Glenn Morris <rgm@gnu.org> 62010-01-14 Glenn Morris <rgm@gnu.org>
2 7
3 * frame.el (show-trailing-whitespace): Safe if boolean. (Bug#5312) 8 * 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."
226;; and delimiter characters. Support function of 226;; and delimiter characters. Support function of
227;; coding-system-from-name. 227;; coding-system-from-name.
228(defun canonicalize-coding-system-name (name) 228(defun canonicalize-coding-system-name (name)
229 (if (string-match "^iso[-_ ]?[0-9]" name) 229 (if (string-match "^\\(ms\\|ibm\\|windows-\\)\\([0-9]+\\)$" name)
230 ;; "iso-8859-1" -> "8859-1", "iso-2022-jp" ->"2022-jp" 230 ;; "ms950", "ibm950", "windows-950" -> "cp950"
231 (setq name (substring name (1- (match-end 0))))) 231 (concat "cp" (match-string 2 name))
232 (let ((idx (string-match "[-_ /]" name))) 232 (if (string-match "^iso[-_ ]?[0-9]" name)
233 ;; Delete "-", "_", " ", "/" but do distinguish "16-be" and "16be". 233 ;; "iso-8859-1" -> "8859-1", "iso-2022-jp" ->"2022-jp"
234 (while idx 234 (setq name (substring name (1- (match-end 0)))))
235 (if (and (>= idx 2) 235 (let ((idx (string-match "[-_ /]" name)))
236 (eq (string-match "16-[lb]e$" name (- idx 2)) 236 ;; Delete "-", "_", " ", "/" but do distinguish "16-be" and "16be".
237 (- idx 2))) 237 (while idx
238 (setq idx (string-match "[-_ /]" name (match-end 0))) 238 (if (and (>= idx 2)
239 (setq name (concat (substring name 0 idx) (substring name (1+ idx))) 239 (eq (string-match "16-[lb]e$" name (- idx 2))
240 idx (string-match "[-_ /]" name idx)))) 240 (- idx 2)))
241 name)) 241 (setq idx (string-match "[-_ /]" name (match-end 0)))
242 (setq name (concat (substring name 0 idx) (substring name (1+ idx)))
243 idx (string-match "[-_ /]" name idx))))
244 name)))
242 245
243(defun coding-system-from-name (name) 246(defun coding-system-from-name (name)
244 "Return a coding system whose name matches with NAME (string or symbol)." 247 "Return a coding system whose name matches with NAME (string or symbol)."