From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Simon Josefsson <jas@extundo.com>
Cc: Frank Schmitt <ich@frank-schmitt.net>,
ding@gnus.org, 1174@emacsbugs.donarmstrong.com
Subject: Re: bug#1174: 23.0.60; Some UTF-8 mails displaying wrongly in Emacs 23
Date: Tue, 02 Dec 2008 02:36:31 -0500 [thread overview]
Message-ID: <jwv3ah7av77.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <87y6yzbjgf.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Mon, 01 Dec 2008 23:48:32 +0100")
> 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) -> <error>
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
next prev parent reply other threads:[~2008-12-02 7:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m37i89boe6.fsf@mid.gehheimdienst.de>
[not found] ` <jeabd5vvug.fsf@sykes.suse.de>
[not found] ` <m363ntey23.fsf@mid.gehheimdienst.de>
[not found] ` <u63nso2wk.fsf@gnu.org>
[not found] ` <jebpxjvd53.fsf@sykes.suse.de>
[not found] ` <m3ej2fd2o0.fsf@mid.gehheimdienst.de>
[not found] ` <umyh3mttj.fsf@gnu.org>
[not found] ` <m33aivfsa8.fsf@mid.gehheimdienst.de>
[not found] ` <jwv8wsnjknd.fsf-monnier+emacsbugreports@gnu.org>
2008-10-17 18:19 ` Reiner Steib
2008-10-17 18:36 ` Frank Schmitt
2008-11-29 12:08 ` Reiner Steib
2008-11-29 12:18 ` Simon Josefsson
2008-11-29 15:30 ` Reiner Steib
2008-11-29 21:30 ` Stefan Monnier
2008-11-30 13:12 ` Reiner Steib
2008-11-29 22:14 ` James Cloos
2008-11-30 13:11 ` View articles with different charset (was: bug#1174: 23.0.60; Some UTF-8 mails displaying wrongly in Emacs 23) Reiner Steib
2008-11-30 21:23 ` View articles with different charset James Cloos
2009-01-12 10:54 ` bug#1174: 23.0.60; Some UTF-8 mails displaying wrongly in Emacs 23 Simon Josefsson
2009-01-12 11:03 ` Frank Schmitt
2009-01-12 11:10 ` Simon Josefsson
2009-01-14 11:20 ` Gabor Z. Papp
2009-01-14 20:12 ` Reiner Steib
2009-01-14 22:08 ` Stefan Monnier
2008-12-01 21:04 ` Stefan Monnier
2008-12-01 22:48 ` Reiner Steib
2008-12-02 7:36 ` Stefan Monnier [this message]
2008-12-04 19:43 ` Reiner Steib
2008-12-04 21:43 ` Frank Schmitt
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=jwv3ah7av77.fsf-monnier+emacsbugreports@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=1174@emacsbugs.donarmstrong.com \
--cc=ding@gnus.org \
--cc=ich@frank-schmitt.net \
--cc=jas@extundo.com \
/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).