unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* character encoding question
@ 2013-02-20  6:34 Eric Abrahamsen
  2013-02-20 10:44 ` Peter Dyballa
  2013-02-20 14:42 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Abrahamsen @ 2013-02-20  6:34 UTC (permalink / raw)
  To: help-gnu-emacs

I'm trying to get a better understanding of character encodings, as I
often have to deal with mis-encoded or mystery-encoded files. I've read
the Non-ASCII Characters section of the elisp manual, and have a fair
sense of what's going on, with a couple of remaining questions.

So the character 中 has a codepoint of #o47055 in octal notation.
Meanwhile:

(string-as-unibyte "中") --> \344\270\255

I understand that each of these three sections is a byte, also in octal.
What's the correspondence between these bytes and the multibyte
character's octal codepoint? Are there any functions that will get from
one to the other?

Second question: If emacs can't guess the encoding of a file, it gives
you an error message showing the bytes it can't decode, plus the
charsets it tried to use. How do I replicate that process manually?
Given a series of mystery bytes, can I test them against different
charsets, and see what gibberish emacs comes up with? I guess I'm
imagining something like "decode-char", except being able to feed it
bytes instead of a character...

Thanks!
Eric




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-21  2:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20  6:34 character encoding question Eric Abrahamsen
2013-02-20 10:44 ` Peter Dyballa
2013-02-20 14:42 ` Stefan Monnier
2013-02-20 18:48   ` Eli Zaretskii
2013-02-21  2:42     ` Eric Abrahamsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).