Function: locale-charset-to-coding-system

locale-charset-to-coding-system is a byte-compiled function defined in mule-cmds.el.gz.

Signature

(locale-charset-to-coding-system CHARSET)

Documentation

Find coding system corresponding to CHARSET.

CHARSET is any sort of non-Emacs charset name, such as might be used in a locale codeset, or elsewhere. It is matched to a coding system first by case-insensitive lookup in locale-charset-alist. Then matches are looked for in the coding system list, treating case and the characters - and _ as insignificant. The coding system base is returned. Thus, for instance, if charset "ISO8859-2", iso-latin-2 is returned.

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-cmds.el.gz
(defun locale-charset-to-coding-system (charset)
  "Find coding system corresponding to CHARSET.
CHARSET is any sort of non-Emacs charset name, such as might be used
in a locale codeset, or elsewhere.  It is matched to a coding system
first by case-insensitive lookup in `locale-charset-alist'.  Then
matches are looked for in the coding system list, treating case and
the characters `-' and `_' as insignificant.  The coding system base
is returned.  Thus, for instance, if charset \"ISO8859-2\",
`iso-latin-2' is returned."
  (or (car (assoc-string charset locale-charset-alist t))
      (let ((cs coding-system-alist)
	    c)
	(while (and (not c) cs)
	  (if (locale-charset-match-p charset (caar cs))
	      (setq c (intern (caar cs)))
	    (pop cs)))
	(if c (coding-system-base c)))))