From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/47157 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.gnus.general Subject: Re: Editing UTF-8 mail messages Date: Sun, 13 Oct 2002 06:42:59 +0200 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1034484339 8402 127.0.0.1 (13 Oct 2002 04:45:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 13 Oct 2002 04:45:39 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 180adF-0002BO-00 for ; Sun, 13 Oct 2002 06:45:37 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 180acO-0006jo-00; Sat, 12 Oct 2002 23:44:44 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sat, 12 Oct 2002 23:45:25 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id XAA26082 for ; Sat, 12 Oct 2002 23:45:14 -0500 (CDT) Original-Received: (qmail 26423 invoked by alias); 13 Oct 2002 04:46:08 -0000 Original-Received: (qmail 26418 invoked from network); 13 Oct 2002 04:46:08 -0000 Original-Received: from pfepa.post.tele.dk (193.162.153.2) by gnus.org with SMTP; 13 Oct 2002 04:46:08 -0000 Original-Received: from defun.localdomain (0xc3d7e0a5.esnxr4.ras.tele.dk [195.215.224.165]) by pfepa.post.tele.dk (Postfix) with ESMTP id C8EAC481306 for ; Sun, 13 Oct 2002 06:44:23 +0200 (CEST) Original-To: ding@gnus.org In-Reply-To: (Karl Eichwalder's message of "Thu, 03 Oct 2002 17:49:04 +0200") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-redhat-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:47157 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:47157 --=-=-= Karl Eichwalder writes: > Editing UTF-8 encoded mail messages does not seem to work reliably. > I'll append such a message mailed to myself using lynx with "wide" > ncurses support. > > The problem: Press e (gnus-summary-edit-article), then C-c C-c. Saving > back the message Gnus turns it into a base64 encoding and worse, it > does not seem to preserve the UTF-8 charset. You are seeing two different problems: 1. When you do a plain `e' Gnus, mangles the encoding. This seems to be one of the usual MULE-related \201-problems. In this case it's caused by `mm-get-part' (in mm-decode.el), which uses the macro `mm-with-unibyte-current-buffer-mule4'. This macro does *not* make the buffer unibyte temporarily. I don't understand the point of `mm-w-u-c-b-mule4' -- it doesn't work. Why is it ever used? I suspect that the use of it in several places could be causing some of the occasional \201-problems. `mm-with-unibyte-current-buffer' *does* work, though. And if we use that macro instead, the problem is fixed (but maybe it breaks older Emacsen?). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=mm-decode.el.diff --- /home/harder/gnus/lisp/mm-decode.el Thu Jul 25 21:34:42 2002 +++ mm-decode.el Sun Oct 13 06:12:36 2002 @@ -953,7 +953,7 @@ "Return the contents of HANDLE as a string." (mm-with-unibyte-buffer (insert (with-current-buffer (mm-handle-buffer handle) - (mm-with-unibyte-current-buffer-mule4 + (mm-with-unibyte-current-buffer (buffer-string)))) (mm-decode-content-transfer-encoding (mm-handle-encoding handle) --=-=-= 2. If you want to preserve the CTE and charset, you should use `C-u 3 e'. Unfortunately, this seems to be broken for text/plain messages. The buffer-local variable `gnus-article-mime-handles' is not set for text/plain. I don't know if it's omitted on purpose -- does someone know?. If it isn't supposed to be set, then here's a patch that will make Gnus construct a MIME handle, when you do `C-u 3 e'. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gnus-sum.el.diff --- /home/harder/gnus/lisp/gnus-sum.el Thu Oct 3 20:25:04 2002 +++ gnus-sum.el Sun Oct 13 06:09:41 2002 @@ -8938,7 +8938,10 @@ (and (gnus-buffer-live-p gnus-article-buffer) (with-current-buffer gnus-article-buffer (prog1 - gnus-article-mime-handles + (or gnus-article-mime-handles + (and (gnus-buffer-live-p gnus-original-article-buffer) + (with-current-buffer gnus-original-article-buffer + (mm-dissect-buffer t)))) (setq gnus-article-mime-handles nil)))))) (t (setq force t))) --=-=-=--