Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Subject: Overriding valid charsets
Date: Fri, 07 Oct 2005 20:29:59 +0200	[thread overview]
Message-ID: <v9irw9w57c.fsf@marauder.physik.uni-ulm.de> (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/




             reply	other threads:[~2005-10-07 18:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-07 18:29 Reiner Steib [this message]
2005-10-11  0:39 ` Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9irw9w57c.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).