all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Roland Winkler" <winkler@gnu.org>
To: Michael Welsh Duggan <md5i@md5i.com>
Cc: emacs-devel@gnu.org
Subject: Re: converting octal escape sequences to utf-8 and back
Date: Sun, 29 May 2011 01:35:58 -0500	[thread overview]
Message-ID: <19937.59726.325082.1568@gargle.gargle.HOWL> (raw)
In-Reply-To: <87vcwuysgp.fsf@maru.md5i.com>

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. 

What am I doing wrong? Do I need anything else for this?

Roland



  reply	other threads:[~2011-05-29  6: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 [this message]
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
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=19937.59726.325082.1568@gargle.gargle.HOWL \
    --to=winkler@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=md5i@md5i.com \
    /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.