unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Peter Dyballa <Peter_Dyballa@Web.DE>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: character encoding question
Date: Wed, 20 Feb 2013 11:44:26 +0100	[thread overview]
Message-ID: <EA415E42-96D2-489F-93F4-551A59ADA6C1@Web.DE> (raw)
In-Reply-To: <87mwuzze5s.fsf@ericabrahamsen.net>


Am 20.02.2013 um 07:34 schrieb Eric Abrahamsen:

> (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?

It's defined in Unicode by the Unicode consortium. The code points in Unicode can be represented by different systems: UTF-7, UTF-8, UTF-16 with least significant byte first or most significant byte first, UTF-32, maybe more. Wikipedia certainly is a good start.

In the example above some Unicode character (#o47055) is represented by a sequence of three bytes. Since the bytes are numerically all greater than 127 it must be saved in UTF-8 encoding. It's U+4E2D, some CJK Ideograph. 

> 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?

C-x RET r – revert-buffer-with-coding-system. The function gives you the choice to select an encoding.

--
Greetings

  Pete

"Debugging? Klingons do not debug! Our software does not coddle the weak."




  reply	other threads:[~2013-02-20 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20  6:34 character encoding question Eric Abrahamsen
2013-02-20 10:44 ` Peter Dyballa [this message]
2013-02-20 14:42 ` Stefan Monnier
2013-02-20 18:48   ` Eli Zaretskii
2013-02-21  2:42     ` Eric Abrahamsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EA415E42-96D2-489F-93F4-551A59ADA6C1@Web.DE \
    --to=peter_dyballa@web.de \
    --cc=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@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.
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).