From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.bugs Subject: 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__4765.47294897518$1228173114$gmane$org@marauder.physik.uni-ulm.de> References: <871vyf6q40.fsf@marauder.physik.uni-ulm.de> <87k5ampwej.fsf@marauder.physik.uni-ulm.de> Reply-To: Reiner Steib , 1174@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228173042 8513 80.91.229.12 (1 Dec 2008 23:10:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Dec 2008 23:10:42 +0000 (UTC) Cc: 1174@emacsbugs.donarmstrong.com, Frank Schmitt , ding@gnus.org, Simon Josefsson To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 02 00:11:41 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 1L7HvP-00034k-VJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Dec 2008 00:11:32 +0100 Original-Received: from localhost ([127.0.0.1]:41481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L7HuF-00079H-Iv for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Dec 2008 18:10:19 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L7HuC-00079C-N5 for bug-gnu-emacs@gnu.org; Mon, 01 Dec 2008 18:10:16 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L7HuC-000790-5Z for bug-gnu-emacs@gnu.org; Mon, 01 Dec 2008 18:10:16 -0500 Original-Received: from [199.232.76.173] (port=39392 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L7HuC-00078x-1b for bug-gnu-emacs@gnu.org; Mon, 01 Dec 2008 18:10:16 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:58240) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L7HuB-0001N1-IG for bug-gnu-emacs@gnu.org; Mon, 01 Dec 2008 18:10:15 -0500 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 mB1NACxq022475; Mon, 1 Dec 2008 15:10:12 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mB1Mt43l017442; Mon, 1 Dec 2008 14:55:04 -0800 X-Loop: don@donarmstrong.com Resent-From: Reiner Steib Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 01 Dec 2008 22:55:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1174 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1174-submit@emacsbugs.donarmstrong.com id=B1174.122817172515953 (code B ref 1174); Mon, 01 Dec 2008 22:55:04 +0000 Original-Received: (at 1174) by emacsbugs.donarmstrong.com; 1 Dec 2008 22:48:45 +0000 Original-Received: from mail.uni-ulm.de (mail.uni-ulm.de [134.60.1.11]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mB1MmdbX015946 for <1174@emacsbugs.donarmstrong.com>; Mon, 1 Dec 2008 14:48:41 -0800 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-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Mon, 01 Dec 2008 18:10:16 -0500 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:22827 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/