From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleksandr Gavenko Newsgroups: gmane.emacs.help Subject: Re: Char code to Emacs string. Date: Wed, 08 Jun 2011 16:39:04 +0300 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1307540522 31435 80.91.229.12 (8 Jun 2011 13:42:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Jun 2011 13:42:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 08 15:41:59 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QUJ1C-0004bo-Kw for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Jun 2011 15:41:58 +0200 Original-Received: from localhost ([::1]:46763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUJ1B-0004d4-Qc for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Jun 2011 09:41:57 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUIye-0004Lo-Tw for help-gnu-emacs@gnu.org; Wed, 08 Jun 2011 09:39:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUIyc-0007AI-Gr for help-gnu-emacs@gnu.org; Wed, 08 Jun 2011 09:39:20 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:49294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUIyc-00079q-2Z for help-gnu-emacs@gnu.org; Wed, 08 Jun 2011 09:39:18 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QUIya-0003AM-6U for help-gnu-emacs@gnu.org; Wed, 08 Jun 2011 15:39:16 +0200 Original-Received: from 91.193.68.214 ([91.193.68.214]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jun 2011 15:39:16 +0200 Original-Received: from gavenko by 91.193.68.214 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jun 2011 15:39:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 32 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 91.193.68.214 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-Spam-Report: 5.4 points; * -0.0 SPF_PASS SPF: sender matches SPF record * 4.0 RCVD_NUMERIC_HELO Received: contains an IP address used for HELO * -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] * 4.0 RCVD_IN_SBL RBL: Received via a relay in Spamhaus SBL * [91.193.68.214 listed in zen.spamhaus.org] Xref: news.gmane.org gmane.emacs.help:81312 Archived-At: On 02.06.2011 17:36, Eli Zaretskii wrote: >> From: Oleksandr Gavenko >> 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)'.