From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.bugs Subject: 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> Reply-To: Katsumi Yamaoka , 935@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1220923677 17740 80.91.229.12 (9 Sep 2008 01:27:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Sep 2008 01:27:57 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, 935@emacsbugs.donarmstrong.com, ding@gnus.org To: Sven Joachim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 09 03:28:52 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kcs2F-0002rV-SI for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Sep 2008 03:28:52 +0200 Original-Received: from localhost ([127.0.0.1]:41885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kcs1F-0004k6-TE for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Sep 2008 21:27:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kcs13-0004bL-3k for bug-gnu-emacs@gnu.org; Mon, 08 Sep 2008 21:27:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kcs11-0004au-Fk for bug-gnu-emacs@gnu.org; Mon, 08 Sep 2008 21:27:36 -0400 Original-Received: from [199.232.76.173] (port=45443 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kcs11-0004ak-7t for bug-gnu-emacs@gnu.org; Mon, 08 Sep 2008 21:27:35 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:48416) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kcs10-0002WE-IA for bug-gnu-emacs@gnu.org; Mon, 08 Sep 2008 21:27:34 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m891RWEj029903; Mon, 8 Sep 2008 18:27:33 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m891A5cf023569; Mon, 8 Sep 2008 18:10:05 -0700 X-Loop: don@donarmstrong.com Resent-From: Katsumi Yamaoka Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 09 Sep 2008 01:10:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 935 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.122092204420480 (code B ref -1); Tue, 09 Sep 2008 01:10:04 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 9 Sep 2008 01:00:44 +0000 Original-Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8910eWk020370 for ; Mon, 8 Sep 2008 18:00:41 -0700 Original-Received: from mx10.gnu.org ([199.232.76.166]:59467) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1KcrZG-0003ym-Nt for emacs-pretest-bug@gnu.org; Mon, 08 Sep 2008 20:58:54 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Kcrau-0006wP-Tw for emacs-pretest-bug@gnu.org; Mon, 08 Sep 2008 21:00:39 -0400 Original-Received: from orlando.hostforweb.net ([216.246.45.90]:56241) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kcrau-0006vo-Eh for emacs-pretest-bug@gnu.org; Mon, 08 Sep 2008 21:00:36 -0400 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 - gnu.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-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-CrossAssassin-Score: 2 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Mon, 08 Sep 2008 21:27:36 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:20368 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))) --=-=-=--