help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Char code to Emacs string.


From: Oleksandr Gavenko
Subject: Re: Char code to Emacs string.
Date: Wed, 08 Jun 2011 16:39:04 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

On 02.06.2011 17:36, Eli Zaretskii wrote:
From: Oleksandr Gavenko<gavenko@bifit.com.ua>
Date: Thu, 02 Jun 2011 15:31:46 +0300

What if I have some bytes and know its charset/coding and want convert
to Emacs string?

If I understand correctly what you want, it's decode-coding-string (if
those "bytes" are given a string) or decode-coding-region (if they are
in a buffer).

I get that I want by:

(insert (decode-coding-string (unibyte-string ?\x21 ?\xff) 'utf-16-le))
A
(insert (decode-coding-string (unibyte-string ?\x21 ?\xff) 'cp1251))
!я

Previously I use (string ?\xff ?\xfa) to make string, which
convert \?xXX to some coding, so I get that I do not want.

and also how get list of coding names for they.

Not sure what you mean here.  If you want the full list of the
encodings supported by Emacs, then "C-h C TAB" will show them.  Is
that you are looking for?

Encodings supported by Emacs, which can be passed to funcs that require
CODING as argument.

Seems you provide that I need. Also these values accessed via
'(coding-system-list)'.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]