From: Eli Zaretskii <eliz@gnu.org>
To: Roland Winkler <winkler@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: converting octal escape sequences to utf-8 and back
Date: Sun, 29 May 2011 04:35:56 -0400 [thread overview]
Message-ID: <E1QQbTY-0006gE-Qe@fencepost.gnu.org> (raw)
In-Reply-To: <87d3j26lih.fsf@niu.edu> (message from Roland Winkler on Sun, 29 May 2011 01:58:30 -0500)
> From: Roland Winkler <winkler@gnu.org>
> 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.
next prev parent reply other threads:[~2011-05-29 8:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-29 0:27 converting octal escape sequences to utf-8 and back Roland Winkler
2011-05-29 2:57 ` Leo
2011-05-29 5:40 ` Michael Welsh Duggan
2011-05-29 6:35 ` Roland Winkler
2011-05-29 20:05 ` Michael Welsh Duggan
2011-05-29 6:47 ` Eli Zaretskii
2011-05-29 6:58 ` Roland Winkler
2011-05-29 8:35 ` Eli Zaretskii [this message]
2011-05-29 19:15 ` Roland Winkler
2011-05-29 8:50 ` Thien-Thi Nguyen
2011-05-29 3:00 ` Eli Zaretskii
2011-05-29 3:48 ` Roland Winkler
2011-05-30 22:39 ` Randal L. Schwartz
2011-05-31 7:14 ` Harald Hanche-Olsen
2011-05-31 17:06 ` Randal L. Schwartz
2011-05-31 20:13 ` PJ Weisberg
2011-05-30 22:54 ` Stefan Monnier
2011-05-31 21:06 ` Roland Winkler
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=E1QQbTY-0006gE-Qe@fencepost.gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=winkler@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.