unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* mm-charset-to-coding-system and mm-charset-synonym-alist
@ 2005-03-16 21:16 Stefan Monnier
  2005-03-17  0:18 ` Kevin Rodgers
  2005-03-18 13:42 ` Reiner Steib
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2005-03-16 21:16 UTC (permalink / raw)
  Cc: emacs-devel

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)

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

* Re: mm-charset-to-coding-system and mm-charset-synonym-alist
  2005-03-16 21:16 mm-charset-to-coding-system and mm-charset-synonym-alist Stefan Monnier
@ 2005-03-17  0:18 ` Kevin Rodgers
  2005-03-18 13:42 ` Reiner Steib
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2005-03-17  0:18 UTC (permalink / raw)


Stefan Monnier wrote:
 > 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?

Yes.  The people who send such messages were put here to annoy the rest
of us, and you're disrupting God's plan and the harmony of the Tao by
not allowing them to achieve their purpose.

-- 
Kevin

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

* Re: mm-charset-to-coding-system and mm-charset-synonym-alist
  2005-03-16 21:16 mm-charset-to-coding-system and mm-charset-synonym-alist Stefan Monnier
  2005-03-17  0:18 ` Kevin Rodgers
@ 2005-03-18 13:42 ` Reiner Steib
  2005-03-18 14:21   ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Reiner Steib @ 2005-03-18 13:42 UTC (permalink / raw)
  Cc: Ding List, Stefan Monnier

On Wed, Mar 16 2005, Stefan Monnier wrote:

> 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

Did you know that you can adding (2 . windows-1252) to
`gnus-summary-show-article-charset-alist' allow you to show the
article as windows-1252 with `2 g'.
 
> 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".

I recall (from the German Gnus newsgroup) that Simon Krahnke (Bcc-ed)
used such a setup.  But after looking at the code, I don't understand
why it worked for him.

> So I suggest the patch below,
> Any objection?

I fear that users may forget about their older setting of
`mm-charset-synonym-alist'.  Then, when upgrading Emacs and new
charsets are available, they will get the substitute charset from
`mm-charset-synonym-alist' instead of the correct charset.

Maybe we could introduce `mm-charset-override-alist' an look at it
before "((and (mm-coding-system-p charset)" or even as the first
cond-clause.  BTW: You patch won't allow to override `us-ascii'.

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



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

* Re: mm-charset-to-coding-system and mm-charset-synonym-alist
  2005-03-18 13:42 ` Reiner Steib
@ 2005-03-18 14:21   ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2005-03-18 14:21 UTC (permalink / raw)
  Cc: Ding List

> Did you know that you can adding (2 . windows-1252) to
> `gnus-summary-show-article-charset-alist' allow you to show the article as
> windows-1252 with `2 g'.

But why bother when you now have it working automatically without any
intervention?


        Stefan



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

end of thread, other threads:[~2005-03-18 14:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-16 21:16 mm-charset-to-coding-system and mm-charset-synonym-alist Stefan Monnier
2005-03-17  0:18 ` Kevin Rodgers
2005-03-18 13:42 ` Reiner Steib
2005-03-18 14:21   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).