From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67343 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general,gmane.emacs.pretest.bugs Subject: Re: bug#935: 23.0.60; gnus-mime-view-part-as-charset displays non-ASCII characters as octals Date: Tue, 09 Sep 2008 10:00:15 +0900 Organization: Emacsen advocacy group Message-ID: References: <877i9mmk91.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1220922083 13130 80.91.229.12 (9 Sep 2008 01:01:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Sep 2008 01:01:23 +0000 (UTC) Cc: 935@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org, ding@gnus.org To: Sven Joachim Original-X-From: ding-owner+M15794=ding+2Daccount=gmane.org@lists.math.uh.edu Tue Sep 09 03:02:18 2008 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1KcrcV-000661-7m for ding-account@gmane.org; Tue, 09 Sep 2008 03:02:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1KcrbT-0007cE-Uy for ding-account@gmane.org; Mon, 08 Sep 2008 20:01:12 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1KcrbR-0007c6-FX for ding@lists.math.uh.edu; Mon, 08 Sep 2008 20:01:09 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1KcrbO-0000g6-Gx for ding@lists.math.uh.edu; Mon, 08 Sep 2008 20:01:09 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1KcrbR-0005dK-00 for ; Tue, 09 Sep 2008 03:01:09 +0200 Original-Received: from localhost ([127.0.0.1]:40153) by orlando.hostforweb.net with esmtpa (Exim 4.69) (envelope-from ) id 1Kcran-0000HC-RT; Mon, 08 Sep 2008 20:00:30 -0500 X-Hashcash: 1:20:080909:svenjoac@gmx.de::SFOTz83QVWZefAxQ:000Dib X-Hashcash: 1:20:080909:935@emacsbugs.donarmstrong.com::l+6BgiUulsxrqH3e:00000000000000000000000000000005uV1 X-Hashcash: 1:20:080909:emacs-pretest-bug@gnu.org::67sTP6TNLQAGwDoz:0000000000000000000000000000000000003j3n X-Hashcash: 1:20:080909:ding@gnus.org::6WJDm/g1BIhlbjh7:00000zQt X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:Qs/fQ3xLnCcFfhfcvQAyXEN1ZOQ= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:67343 gmane.emacs.pretest.bugs:23019 Archived-At: --=-=-= >>>>> Sven Joachim wrote: > I have a problem with the gnus-mime-view-part-as-charset command that > only shows up in Emacs 23, not sure whether this is a bug in Emacs or in > Gnus. > If an article has attachment with a wrongly specified charset, Gnus can > work around that with the gnus-mime-view-part-as-charset command. For > instance, on > gmane.linux.debian.internationalization.german aka > debian-l10n-german@lists.debian.org is such an article, it has an > attachment that is incorrectly described as "Content-Type: text/x-diff; > charset=utf-8" while it's actually encoded as iso-latin-1. Now when I > press C RET iso-latin-1, Emacs displays the German umlauts as octal > sequences. In Emacs 22.3, they are displayed correctly (Gnus version is > the same, current No Gnus CVS). That's exactly a bug. Even in Emacs 22.3, it is not displayed correctly if attachment contains CJK characters with wrong charset. The patch is below. I'll commit this after testing it further. --=-=-= Content-Type: text/x-diff Content-Disposition: inline --- gnus-art.el~ 2008-08-11 22:24:20 +0000 +++ gnus-art.el 2008-09-09 00:56:42 +0000 @@ -5138,8 +5138,9 @@ (mm-string-to-multibyte contents))) (goto-char b))))) -(defun gnus-mime-strip-charset-parameters (handle) - "Strip charset parameters from HANDLE." +(defun gnus-mime-set-charset-parameters (handle) + "Set charset to parameters in HANDLE. +The value of `gnus-newsgroup-charset' is used as a charset." (if (stringp (car handle)) (mapc #'gnus-mime-strip-charset-parameters (cdr handle)) (let* ((type (mm-handle-type (if (equal (mm-handle-media-type handle) @@ -5150,8 +5151,10 @@ (mm-handle-cache handle)) handle))) (charset (assq 'charset (cdr type)))) - (when charset - (delq charset type))))) + (if charset + (setcdr charset gnus-newsgroup-charset) + (setcdr type (cons (cons 'charset gnus-newsgroup-charset) + (cdr type))))))) (defun gnus-mime-view-part-as-charset (&optional handle arg) "Insert the MIME part under point into the current buffer using the @@ -5172,7 +5175,7 @@ (mm-read-coding-system "Charset: ")))) (if (mm-handle-undisplayer handle) (mm-remove-part handle))) - (gnus-mime-strip-charset-parameters handle) + (gnus-mime-set-charset-parameters handle) (when (and (consp (setq form (cdr-safe fun))) (setq form (ignore-errors (assq 'gnus-mime-display-alternative form))) --=-=-=--