[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: converting octal escape sequences to utf-8 and back
From: |
Michael Welsh Duggan |
Subject: |
Re: converting octal escape sequences to utf-8 and back |
Date: |
Sun, 29 May 2011 16:05:37 -0400 |
User-agent: |
Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) |
"Roland Winkler" <address@hidden> writes:
> On Sun May 29 2011 Michael Welsh Duggan wrote:
>> As Leo says:
>>
>> (encode-coding-string "§" 'utf-8)
>> "\302\247"
>> (decode-coding-string "\302\247" 'utf-8)
>> "§"
>
> The decoding seems to work fine this way, but not the encoding.
> If I start out with the 8-character ascii string "\302\247" the
> following does not give me back this 8-character string:
>
> (with-temp-file "~/foo.txt"
> (insert (encode-coding-string
> (decode-coding-string "\302\247" 'utf-8) 'utf-8)))
>
> This will ask me for the coding system I want, suggesting the
> default 'raw-text. Then I end up with a file that has only two
> bytes, instead of the eight bytes I want.
(with-temp-file "~/foo.txt"
(insert (substring (prin1-to-string
(encode-coding-string
(decode-coding-string "\302\247" 'utf-8)'utf-8))
1 -1)))
--
Michael Welsh Duggan
(address@hidden)
- converting octal escape sequences to utf-8 and back, Roland Winkler, 2011/05/28
- Re: converting octal escape sequences to utf-8 and back, Leo, 2011/05/28
- Re: converting octal escape sequences to utf-8 and back, Michael Welsh Duggan, 2011/05/29
- Re: converting octal escape sequences to utf-8 and back, Eli Zaretskii, 2011/05/29
- Re: converting octal escape sequences to utf-8 and back, Roland Winkler, 2011/05/29
- Re: converting octal escape sequences to utf-8 and back, Eli Zaretskii, 2011/05/29
- Re: converting octal escape sequences to utf-8 and back, Roland Winkler, 2011/05/29
- Re: converting octal escape sequences to utf-8 and back, Thien-Thi Nguyen, 2011/05/29
Re: converting octal escape sequences to utf-8 and back, Eli Zaretskii, 2011/05/28
Re: converting octal escape sequences to utf-8 and back, Randal L. Schwartz, 2011/05/30