Gnus development mailing list
 help / color / mirror / Atom feed
* Overriding valid charsets
@ 2005-10-07 18:29 Reiner Steib
  2005-10-11  0:39 ` Katsumi Yamaoka
  0 siblings, 1 reply; 2+ messages in thread
From: Reiner Steib @ 2005-10-07 18:29 UTC (permalink / raw)


Hi,

[ A question in gnu.emacs.help reminded me of an uncommitted patch in
  my work space.  <http://thread.gmane.org/gmane.emacs.help/30023> ]

we already have a mechanism in Gnus to say "treat charset `windows-foo'
as `iso-8859-1', if we don't have `windows-foo'": 

,----[ <f1> v mm-charset-synonym-alist RET ]
| mm-charset-synonym-alist is a variable defined in `mm-util'.
| Its value is 
| ((big5-hkscs . big5)
|  (unicode . utf-16-le)
|  (ks_c_5601-1987 . cp949))
| 
| Documentation:
| A mapping from invalid charset names to the real charset names.
`----

But (to my knowledge) we don't have a mechanism to say "treat
`iso-8859-1' as `windows-1252' even if `iso-8859-1' is a valid
charset".  `windows-1252' is a superset of `iso-8859-1' so this would
not hurt for correctly labeled `iso-8859-1' postings, but it would
display "labeled as `iso-8859-1', but in fact it's `windows-1252'"
too.  We also don't have "treat unlabeled (undecided) as `what-ever'".

--8<---------------cut here---------------start------------->8---
--- mm-util.el	04 Oct 2005 17:16:17 +0200	7.36
+++ mm-util.el	07 Oct 2005 20:19:06 +0200	
@@ -195,7 +195,24 @@
 	    '((ks_c_5601-1987 . cp949))
 	  '((ks_c_5601-1987 . euc-kr))))
     )
-  "A mapping from invalid charset names to the real charset names.")
+  "A mapping from unknown or invalid charset names to the real charset names.")
+
+(defcustom mm-charset-override-alist
+  `((iso-8859-1 . windows-1252))
+  "A mapping from undesired charset names to their replacement.
+
+You may add pair like (iso-8859-1 . windows-1252) here,
+i.e. treat iso-8859-1 as windows-1252.  windows-1252 is a
+superset of iso-8859-1."
+  :type '(list (set :inline t
+		    (const (iso-8859-1 . windows-1252))
+		    (const (undecided  . windows-1252)))
+	       (repeat :inline t
+		       :tag "Other options"
+		       (cons (symbol :tag "From charset")
+			     (symbol :tag "To charset"))))
+  :version "23.0" ;; No Gnus
+  :group 'mime)
 
 (defvar mm-binary-coding-system
   (cond
@@ -436,6 +453,9 @@
    ((or (null (mm-get-coding-system-list))
 	(not (fboundp 'coding-system-get)))
     charset)
+   ;; Check override list quite early:
+   ((let ((cs (cdr (assq charset mm-charset-override-alist))))
+      (and cs (mm-coding-system-p cs) cs)))
    ;; ascii
    ((eq charset 'us-ascii)
     'ascii)
--8<---------------cut here---------------end--------------->8---

WDYT?

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Overriding valid charsets
  2005-10-07 18:29 Overriding valid charsets Reiner Steib
@ 2005-10-11  0:39 ` Katsumi Yamaoka
  0 siblings, 0 replies; 2+ messages in thread
From: Katsumi Yamaoka @ 2005-10-11  0:39 UTC (permalink / raw)


>>>>> In <v9irw9w57c.fsf@marauder.physik.uni-ulm.de> Reiner Steib wrote:

>| mm-charset-synonym-alist is a variable defined in `mm-util'.

[...]

> But (to my knowledge) we don't have a mechanism to say "treat
> `iso-8859-1' as `windows-1252' even if `iso-8859-1' is a valid
> charset".  `windows-1252' is a superset of `iso-8859-1' so this would
> not hurt for correctly labeled `iso-8859-1' postings, but it would
> display "labeled as `iso-8859-1', but in fact it's `windows-1252'"
> too.  We also don't have "treat unlabeled (undecided) as `what-ever'".

I think making Gnus do it is a good idea.  I'm not troubled with
such mails so much but I know a lot of European web pages use
`windows-1252' in spite of labeling as `charset=iso-8859-1'.  So,
I improved emacs-w3m (in CVS) so that it might use `windows-1252'
aggressively in such a case.  (I can only identify if it displays
the euro sign correctly, though. ;-)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-11  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-07 18:29 Overriding valid charsets Reiner Steib
2005-10-11  0:39 ` Katsumi Yamaoka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).