From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#1174: 23.0.60; Some UTF-8 mails displaying wrongly in Emacs 23 Date: Tue, 02 Dec 2008 02:36:31 -0500 Message-ID: References: <871vyf6q40.fsf@marauder.physik.uni-ulm.de> <87k5ampwej.fsf@marauder.physik.uni-ulm.de> <87y6yzbjgf.fsf@marauder.physik.uni-ulm.de> Reply-To: Stefan Monnier , 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 1228204235 13646 80.91.229.12 (2 Dec 2008 07:50:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Dec 2008 07:50:35 +0000 (UTC) Cc: 1174@emacsbugs.donarmstrong.com, Frank Schmitt , ding@gnus.org To: Simon Josefsson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 02 08:51:39 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 1L7Q2h-0000Mc-W7 for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Dec 2008 08:51:36 +0100 Original-Received: from localhost ([127.0.0.1]:51114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L7Q1X-00037o-QJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Dec 2008 02:50:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L7Q1U-00037X-9j for bug-gnu-emacs@gnu.org; Tue, 02 Dec 2008 02:50:20 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L7Q1R-00037L-T8 for bug-gnu-emacs@gnu.org; Tue, 02 Dec 2008 02:50:19 -0500 Original-Received: from [199.232.76.173] (port=33269 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L7Q1R-00037I-Lo for bug-gnu-emacs@gnu.org; Tue, 02 Dec 2008 02:50:17 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:3720) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L7Q1R-0000lf-Bo for bug-gnu-emacs@gnu.org; Tue, 02 Dec 2008 02:50:17 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L7Q1Q-0005zU-Dh for bug-gnu-emacs@gnu.org; Tue, 02 Dec 2008 02:50:16 -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 mB27oCAK024556; Mon, 1 Dec 2008 23:50:13 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mB27j2kN022581; Mon, 1 Dec 2008 23:45:02 -0800 X-Loop: don@donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 02 Dec 2008 07:45:02 +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.122820340121276 (code B ref 1174); Tue, 02 Dec 2008 07:45:02 +0000 Original-Received: (at 1174) by emacsbugs.donarmstrong.com; 2 Dec 2008 07:36:41 +0000 Original-Received: from ironport2-out.teksavvy.com (ironport2-out.teksavvy.com [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mB27ab26021270 for <1174@emacsbugs.donarmstrong.com>; Mon, 1 Dec 2008 23:36:39 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar0EAHx0NEnO+Jkl/2dsb2JhbACBbc8Rgn2BIw X-IronPort-AV: E=Sophos;i="4.33,701,1220241600"; d="scan'208";a="30526338" Original-Received: from 206-248-153-37.dsl.teksavvy.com (HELO pastel.home) ([206.248.153.37]) by ironport2-out.teksavvy.com with ESMTP; 02 Dec 2008 02:36:31 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id A9AC08BAF; Tue, 2 Dec 2008 02:36:31 -0500 (EST) In-Reply-To: <87y6yzbjgf.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Mon, 01 Dec 2008 23:48:32 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by mx20.gnu.org: Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Resent-Date: Tue, 02 Dec 2008 02:50:19 -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:22834 Archived-At: > 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 ""))))) Oh, that's clever: yes, the mapconcat/char-to-string dance does make it implement the string-to-multibyte behavior because doing the string-as-multibyte conversion one byte at a time avoids the problematic case. To quote myself from mm-util.el: ;; string-as-multibyte often doesn't really do what you think it does. ;; Example: ;; (aref (string-as-multibyte "\201") 0) -> 129 (aka ?\201) ;; (aref (string-as-multibyte "\300") 0) -> 192 (aka ?\300) ;; (aref (string-as-multibyte "\300\201") 0) -> 192 (aka ?\300) ;; (aref (string-as-multibyte "\300\201") 1) -> 129 (aka ?\201) ;; but ;; (aref (string-as-multibyte "\201\300") 0) -> 2240 ;; (aref (string-as-multibyte "\201\300") 1) -> Basically when the sring passed is made of a single byte, string-as-multibyte is equal to string-to-multibyte, which is the property ued by the code you quoted above to build a poor man's string-to-multibyte. Stefan