From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/59983 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.gnus.general Subject: Re: wrong charset in spite of proper format Date: Thu, 10 Mar 2005 19:53:21 +0100 Organization: Dept. of Theoretical Physics, University of Ulm Message-ID: References: Reply-To: Reiner Steib NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1110481204 2337 80.91.229.2 (10 Mar 2005 19:00:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 10 Mar 2005 19:00:04 +0000 (UTC) Original-X-From: ding-owner+M8524@lists.math.uh.edu Thu Mar 10 20:00:04 2005 Original-Received: from malifon.math.uh.edu ([129.7.128.13] ident=mail) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9St0-0004CR-QL for ding-account@gmane.org; Thu, 10 Mar 2005 19:59:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1D9SnR-0005Y5-00; Thu, 10 Mar 2005 12:54:09 -0600 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1D9SnL-0005Y0-00 for ding@lists.math.uh.edu; Thu, 10 Mar 2005 12:54:03 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1D9SnH-0007U4-Td for ding@lists.math.uh.edu; Thu, 10 Mar 2005 12:54:00 -0600 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1D9SnG-0006qE-00 for ; Thu, 10 Mar 2005 19:53:58 +0100 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1D9Smb-0003Kh-6l for ding@gnus.org; Thu, 10 Mar 2005 19:53:17 +0100 Original-Received: from bridgekeeper.physik.uni-ulm.de ([134.60.10.123]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Mar 2005 19:53:17 +0100 Original-Received: from Reiner.Steib by bridgekeeper.physik.uni-ulm.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Mar 2005 19:53:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-To: ding@gnus.org Original-Lines: 152 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: bridgekeeper.physik.uni-ulm.de X-Face: #vK]N[`vqjuod*|)'[iD7/"3AB-ApT%fmN"LWAg@oS7OesGv~)n[OBTLM#I="J'Y^-7I I/ps7o_'IK@#-Rs{::DZ@O8yS|fexe,XslY[:dNWOb~>?mC-&i_c)say:"\IpA.5U.b]'NY;Pks{lb h.+#6%DpZuaK3dcHB`Av3zc:r!C%~s0&m,tWj]&},qg.+0ww2gK%f!:GK|wMl.I!(voY*1"^li8"~B BNG)9LvPi?^DMR-GVDnZqhu*3Hi,+g=wFhI)BL6&u{EOVEHjVEVq~d?_}lMntWAc3(6?kftjc>_f>! g0wM(qPM$d5]^TT_Qyi&L?LGVG)SHN;Gk/,pkY9,~ Mail-Copies-To: nobody User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:5mLT35dDox8xQgqNfW11bEmSO2U= X-Spam-Score: -4.9 (----) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu X-MailScanner-From: ding-owner+m8524@lists.math.uh.edu X-MailScanner-To: ding-account@gmane.org Xref: news.gmane.org gmane.emacs.gnus.general:59983 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:59983 --=-=-= On Thu, Mar 10 2005, Matthias Andree wrote: > OK. My complaint is that as a result of Emacs 21.SOME_MINOR_RELEASE not > providing a particular character set, Gnus display anything else rather > than falling back to ASCII (where appropriate), masking the unprintables > and stuffing a status line that reads something like "windows-1251 not > supported by your emacs, displaying ASCII parts" [...] > This is along the lines Simon Josefsson suggested one and a half > years ago WRT Windows-1252. > > It is a shame that such functionality still isn't enabled in the default > No Gnus after such a long time. :-( Could you try the following patch? [*] It should automatically do the setup for windows-125[0137] (which are available in Emacs 21). If no charset (or alias) is found, it will print a message. (Displaying as ASCII is and replacing unknown chars with `?' is not included. I'm not sure how this could be achieved in Gnus.) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=rs-mm-util-auto-charset.patch --- mm-util.el 21 Feb 2005 12:42:41 +0100 7.26 +++ mm-util.el 10 Mar 2005 19:31:33 +0100 @@ -142,6 +142,34 @@ ;; Is this branch ever actually useful? (car (memq cs (mm-get-coding-system-list)))))) +(defun mm-codepage-setup (number) + "Create a coding system cpNUMBER and an alias for windows-NUMBER. +The coding system is created using `codepage-setup'. The alias +is added to `mm-charset-synonym-alist'." + (interactive + (let ((completion-ignore-case t) + (candidates (cp-supported-codepages))) + (list (completing-read "Setup DOS Codepage: (default 437) " candidates + nil t nil nil "437")))) + (let* ((cp (intern (format "cp%s" number))) + (alias (intern (format "windows-%s" number)))) + (unless (mm-coding-system-p cp) + (when (codepage-setup number) + (unless (mm-coding-system-p alias) + (add-to-list 'mm-charset-synonym-alist + (cons alias cp))))))) + +(defvar mm-charset-eval-alist + '(;; (iso-8859-13 . (require 'code-pages)) + ;; Emacs 21 offers: 1250 1251 1253 1257 + (windows-1250 . (mm-codepage-setup 1250)) + (windows-1251 . (mm-codepage-setup 1251)) + (windows-1253 . (mm-codepage-setup 1253)) + (windows-1257 . (mm-codepage-setup 1257))) + "An alist of \(charset . form\) pairs. +If an article is encoded in an unknown CHARSET, FORM is evaluated. +This allows to load additional libraries providing CHARSETS.") + (defvar mm-charset-synonym-alist `( ;; Not in XEmacs, but it's not a proper MIME charset anyhow. @@ -175,7 +203,7 @@ '((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.") (defvar mm-binary-coding-system (cond @@ -400,6 +428,10 @@ (pop alist)) out))) +;; FIXME: `gnus-message' must be replaced by `message'. This is just for +;; testing. +(autoload 'gnus-message "gnus-util") + (defun mm-charset-to-coding-system (charset &optional lbt) "Return coding-system corresponding to CHARSET. CHARSET is a symbol naming a MIME charset. @@ -428,9 +460,26 @@ ;;; (eq charset (coding-system-get charset 'mime-charset)) ) charset) + ;; Eval expressions from `mm-charset-eval-alist' + ((let* ((el (assq charset mm-charset-eval-alist)) + (cs (car el)) + (form (cdr el))) + (and cs + form + ;; Avoid errors... + (condition-case nil (eval form) (error nil)) + ;; (message "Failed to eval `%s'" form)) + (mm-coding-system-p cs) + (gnus-message 7 "Added charset `%s' via `mm-charset-eval-alist'" cs) + cs))) ;; Translate invalid charsets. ((let ((cs (cdr (assq charset mm-charset-synonym-alist)))) - (and cs (mm-coding-system-p cs) cs))) + (and cs + (mm-coding-system-p cs) + (gnus-message 7 + "Using synonym `%s' from `mm-charset-synonym-alist' for `%s'" + cs charset) + cs))) ;; Last resort: search the coding system list for entries which ;; have the right mime-charset in case the canonical name isn't ;; defined (though it should be). @@ -442,6 +491,8 @@ (eq charset (or (coding-system-get c :mime-charset) (coding-system-get c 'mime-charset)))) (setq cs c))) + (unless cs + (gnus-message 7 "Unknown charset: %s" charset)) cs)))) (eval-and-compile --=-=-= >> [1] More on (X)Emacs, Gnus and charsets (in German): >> http://theotp1.physik.uni-ulm.de/~ste/comp/emacs/gnus/draft/ > > Currently unavailable. Up again. (But probably not up to date WRT Emacs 22.) Bye, Reiner. [*] I've posted a series of test postings for windows-125* to : -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ --=-=-=--