[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: decode-coding-region returns octal escapes
From: |
Kenichi Handa |
Subject: |
Re: decode-coding-region returns octal escapes |
Date: |
Tue, 10 Feb 2009 15:55:12 +0900 |
In article <address@hidden>, Eli Zaretskii <address@hidden> 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
address@hidden