From: Kenichi Handa <handa@m17n.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: decode-coding-region returns octal escapes
Date: Tue, 10 Feb 2009 15:55:12 +0900 [thread overview]
Message-ID: <E1LWmWW-0005f8-Is@etlken> (raw)
In-Reply-To: <uab8ytq12.fsf@gnu.org> (message from Eli Zaretskii on Sat, 07 Feb 2009 14:00:57 +0200)
In article <uab8ytq12.fsf@gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:
> To reproduce:
> emacs -Q
> M-x find-file-literally RET etc/tutorials/TUTORIAL.de RET
> (The German tutorial is just an example, you can use any one, but
> others might need different values of the 3rd argument to
> decode-coding-region below.)
> Now mark a region that includes non-ASCII characters, for example,
> this one, on line 7 of the file:
> da\337 die CONTROL-Taste gedr\374ckt sein mu\337
> and type
> M-: (decode-coding-region (mark) (point) 'latin-1 t) RET
> The result is that the echo area shows this:
> #("da\337 die CONTROL-Taste gedr\374ckt sein mu\337" 0 39 (charset iso-8859-1))
> and the *Messages* buffer shows this:
> #("da\303\237 die CONTROL-Taste gedr\303\274ckt sein mu\303\237" 0 39 (charset iso-8859-1))
> But I expected to see this in both cases:
> #("daß die CONTROL-Taste gedrückt sein muß" 0 39 (charset iso-8859-1))
At least decode-coding-string is working correctly. Please
try this instead:
M-: (setq str (decode-coding-region (mark) (point) 'latin-1 t)) RET
C-h v str RET
You'll see the correct multibyte string.
> Is this a bug? If not, what is the explanation for what I see? Why
> are raw bytes inserted instead of decoded characters?
It seems that `message' function somehow uses
enable-multibyte-characters of the current buffer to decide
how to show a string.
When I do this after the above C-h v:
M-: (message "%s" str) RET
I see those octals, but when I do that while I'm in a
multibyte buffer, I see correct characters.
---
Kenichi Handa
handa@m17n.org
prev parent reply other threads:[~2009-02-10 6:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-07 12:00 decode-coding-region returns octal escapes Eli Zaretskii
2009-02-10 6:55 ` Kenichi Handa [this message]
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=E1LWmWW-0005f8-Is@etlken \
--to=handa@m17n.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.