From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: mm-charset-to-coding-system and mm-charset-synonym-alist Date: Wed, 16 Mar 2005 16:16:54 -0500 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1111009952 23349 80.91.229.2 (16 Mar 2005 21:52:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 Mar 2005 21:52:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 16 22:52:32 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DBgPG-0008Tr-4y for ged-emacs-devel@m.gmane.org; Wed, 16 Mar 2005 22:50:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DBgfP-0002nC-TU for ged-emacs-devel@m.gmane.org; Wed, 16 Mar 2005 17:07:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DBgWm-0000XB-SF for emacs-devel@gnu.org; Wed, 16 Mar 2005 16:58:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DBgWZ-0000Rv-IC for emacs-devel@gnu.org; Wed, 16 Mar 2005 16:57:56 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DBgWY-0000Lh-Rv for emacs-devel@gnu.org; Wed, 16 Mar 2005 16:57:54 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DBfsx-0002R0-8Z for emacs-devel@gnu.org; Wed, 16 Mar 2005 16:16:59 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 5B40A340004; Wed, 16 Mar 2005 16:16:58 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id F35A14AC21D; Wed, 16 Mar 2005 16:16:54 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id DD3C8F696F; Wed, 16 Mar 2005 16:16:54 -0500 (EST) Original-To: bugs@gnus.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-3.484, requis 5, AWL -1.26, BAYES_00 -4.90, SUBJ_HAS_UNIQ_ID 2.68) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34646 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34646 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)