Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: Sven Joachim <svenjoac@gmx.de>
Cc: 935@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org, ding@gnus.org
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	[thread overview]
Message-ID: <b4mr67unnfk.fsf@jpl.org> (raw)
In-Reply-To: <877i9mmk91.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]

>>>>> 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, <news:20080908175652.GF4996@firemoth> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 1404 bytes --]

--- 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)))

  reply	other threads:[~2008-09-09  1:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-08 20:54 Sven Joachim
2008-09-09  1:00 ` Katsumi Yamaoka [this message]
2008-09-09  6:23   ` Katsumi Yamaoka
     [not found] ` <b4mr67unnfk.fsf__39297.7221440107$1220923731$gmane$org@jpl.org>
2008-09-09 11:46   ` Daiki Ueno
2008-09-09 22:48     ` Katsumi Yamaoka
2008-09-14 16:48       ` Sven Joachim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4mr67unnfk.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=935@emacsbugs.donarmstrong.com \
    --cc=ding@gnus.org \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=svenjoac@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).