[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mm-charset-to-coding-system and mm-charset-synonym-alist
From: |
Stefan Monnier |
Subject: |
mm-charset-to-coding-system and mm-charset-synonym-alist |
Date: |
Wed, 16 Mar 2005 16:16:54 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Is there any good reason why mm-charset-to-coding-system only looks up
mm-charset-synonym-alist after checking mm-coding-system-p?
I'm being annoyed with email encoded in windows-1252 but labelled as latin-1
and figured that I could simply put
;; Since windows-1252 is a superset of latin-1 and some email encoded in
;; windows-1252 are labelled as latin-1, let's just always use windows-1252
;; whenever the label says latin-1.
(add-to-list 'mm-charset-synonym-alist '(iso-8859-1 . windows-1252))
in my .gnus, but it didn't work because mm-charset-synonym-alist is not
consulted if the charset label says "iso-8859-1" because there is
a coding-system called "iso-8859-1".
So I suggest the patch below,
Any objection?
Stefan
--- orig/lisp/gnus/mm-util.el
+++ mod/lisp/gnus/mm-util.el
@@ -421,18 +421,18 @@
;; ascii
((eq charset 'us-ascii)
'ascii)
+ ;; Translate invalid charsets.
+ ((let ((cs (cdr (assq charset mm-charset-synonym-alist))))
+ (and cs (mm-coding-system-p cs) cs)))
;; Check to see whether we can handle this charset. (This depends
;; on there being some coding system matching each `mime-charset'
;; property defined, as there should be.)
((and (mm-coding-system-p charset)
-;;; Doing this would potentially weed out incorrect charsets.
-;;; charset
-;;; (eq charset (coding-system-get charset 'mime-charset))
+ ;; Doing this would potentially weed out incorrect charsets.
+ ;; charset
+ ;; (eq charset (coding-system-get charset 'mime-charset))
)
charset)
- ;; Translate invalid charsets.
- ((let ((cs (cdr (assq charset mm-charset-synonym-alist))))
- (and cs (mm-coding-system-p cs) cs)))
;; Try to find ones that are spelled similarly.
((let ((cs (replace-regexp-in-string "[-_]" "" (symbol-name charset)))
res)
- mm-charset-to-coding-system and mm-charset-synonym-alist,
Stefan Monnier <=