From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67836 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.gnus.general Subject: Re: bug#1174: 23.0.60; Some UTF-8 mails displaying wrongly in Emacs 23 Date: Mon, 01 Dec 2008 23:48:32 +0100 Message-ID: <87y6yzbjgf.fsf@marauder.physik.uni-ulm.de> References: <871vyf6q40.fsf@marauder.physik.uni-ulm.de> <87k5ampwej.fsf@marauder.physik.uni-ulm.de> Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228171779 4261 80.91.229.12 (1 Dec 2008 22:49:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Dec 2008 22:49:39 +0000 (UTC) Cc: Simon Josefsson , Frank Schmitt , ding@gnus.org, 1174@emacsbugs.donarmstrong.com To: Stefan Monnier Original-X-From: ding-owner+M16283@lists.math.uh.edu Mon Dec 01 23:50:39 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 1L7HbC-0004Rr-Da for ding-account@gmane.org; Mon, 01 Dec 2008 23:50:38 +0100 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 1L7HZe-0003Tl-S6; Mon, 01 Dec 2008 16:49:02 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1L7HZd-0003TW-GK for ding@lists.math.uh.edu; Mon, 01 Dec 2008 16:49:01 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1L7HZX-0000yv-9J for ding@lists.math.uh.edu; Mon, 01 Dec 2008 16:49:01 -0600 Original-Received: from mail.uni-ulm.de ([134.60.1.11]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1L7HZi-0006EA-00 for ; Mon, 01 Dec 2008 23:49:06 +0100 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.175]) by mail.uni-ulm.de (8.14.2/8.14.2) with ESMTP id mB1MmZ3U011009; Mon, 1 Dec 2008 23:48:36 +0100 (MET) Original-Received: from localhost (localhost [127.0.0.1]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id 65351133D9; Mon, 1 Dec 2008 23:48:35 +0100 (CET) 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-Followup-To: Stefan Monnier , Simon Josefsson , Frank Schmitt , ding@gnus.org, 1174@emacsbugs.donarmstrong.com In-Reply-To: (Stefan Monnier's message of "Mon, 01 Dec 2008 16:04:01 -0500") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux) X-DCC-Misty-Metrics: poseidon 1170; Body=5 Fuz1=5 Fuz2=5 X-Virus-Scanned: by amavisd-new X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:67836 Archived-At: On Mon, Dec 01 2008, Stefan Monnier wrote: > Having looked at the code again, I'm more than ever confident that > string-to-unibyte is the right thing to use. Maybe the code I installed > back then failed to fallback to string-as-unibyte when string-to-unibyte > was not available, which caused a bug for Simon? Yes, it didn't fall back to string-as-unibyte: --- nnimap.el 17 Aug 2004 14:27:16 -0000 7.7 +++ nnimap.el 30 Aug 2004 18:13:58 -0000 7.8 [...] @@ -845,9 +847,12 @@ (nnoo-status-message 'nnimap server))) (defun nnimap-demule (string) - (funcall (if (and (fboundp 'string-as-multibyte) - (subrp (symbol-function 'string-as-multibyte))) - 'string-as-multibyte + ;; BEWARE: we used to use string-as-multibyte here which is braindead + ;; because it will turn accidental emacs-mule-valid byte sequences + ;; into multibyte chars. --Stef + (funcall (if (and (fboundp 'string-to-multibyte) + (subrp (symbol-function 'string-to-multibyte))) + 'string-to-multibyte 'identity) (or string ""))) > In any case the newly committed code has a prenthesis typo that makes > it still use the old code and ignore the new config var > nnimap-demule-use-string-to-multibyte. Oops, stupid me. > Also I recommend to just use the patch below instead. The first hunk > removes an unnecessary use of nnimap-demule since the output will be > inserted into a unibyte buffer. Thanks for your analysis. Please install the patch. I'll pull it into Gnus CVS ASAP (unless Miles syncs first). > +;; We used to use a string-as-multibyte here, but it is really incorrect. > +;; This function is used when we're about to insert a unibyte string > +;; into a potentially multibyte buffer. The string is either an article > +;; header or body (or both?), undecoded. When Emacs is asked to convert > +;; a unibyte string to multibyte, it may either use the equivalent of > +;; nothing (e.g. non-Mule XEmacs), string-make-unibyte (i.e. decode using > +;; locale), string-as-multibyte (decode using emacs-internal coding system) > +;; or string-to-multibyte (keep the data undecoded as a sequence of bytes). > +;; Only the last one preserves the data such that we can reliably later on > +;; decode the text using the mime info. > +(defalias 'nnimap-demule 'mm-string-to-multibyte) In Emacs 21 (which Gnus still aim to be compatible with), we have string-as-multibyte, but not string-to-multibyte. So your proposed code (i.e. mm-string-to-multibyte) runs (string-as-multibyte (char-to-string string)) whereas we used to run (string-as-multibyte string) Does char-to-string matter here? (defalias 'mm-string-to-multibyte (cond ((featurep 'xemacs) 'identity) ((fboundp 'string-to-multibyte) 'string-to-multibyte) (t (lambda (string) "Return a multibyte string with the same individual chars as string." (mapconcat (lambda (ch) (mm-string-as-multibyte (char-to-string ch))) string ""))))) Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/