[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: |
Eli Zaretskii |
Subject: |
Re: converting octal escape sequences to utf-8 and back |
Date: |
Sun, 29 May 2011 04:35:56 -0400 |
> From: Roland Winkler <address@hidden>
> Date: Sun, 29 May 2011 01:58:30 -0500
>
> > IOW, encode-coding-string produces the encoding specified by its 3rd
> > argument, not its ASCII representation.
>
> ...So it seems that emacs knows already what I would like to have (at
> least its display engine).
Nitpicking: It's not the display engine that does that, it's
eval-last-sexp.
> How can I achieve that I actually get this in an output file, too?
> Are there some formulas that allow one to calculate these octal
> sequences?
This should do what you want:
(with-output-to-string (princ (encode-coding-string STRING 'utf-8)))
(the STRING argument should be the entire string that you want to send
to that program of yours).
But this is crazy, IMO: Lisp code should not need to jump through the
hoops like that to produce such an octal representation. TRT is to
have a special encoding for this, then you could simply say
(encode-coding-string STRING 'foo)
or even just
(encode-coding-region START END 'foo)
because I presume that your original text comes from some buffer.
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
Re: converting octal escape sequences to utf-8 and back, Stefan Monnier, 2011/05/30