From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: decode-coding-string question Date: Fri, 15 Aug 2008 10:37:59 +0300 Message-ID: References: <86wsijz4wt.fsf@lifelogs.com> <877iajck9s.fsf@sphinx.net.ru> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1218785943 27061 80.91.229.12 (15 Aug 2008 07:39:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Aug 2008 07:39:03 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 15 09:39:55 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KTtuc-0003CK-Ah for geh-help-gnu-emacs@m.gmane.org; Fri, 15 Aug 2008 09:39:54 +0200 Original-Received: from localhost ([127.0.0.1]:55617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTttf-0003v1-Sc for geh-help-gnu-emacs@m.gmane.org; Fri, 15 Aug 2008 03:38:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTtsp-0003Sk-Lr for help-gnu-emacs@gnu.org; Fri, 15 Aug 2008 03:38:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTtso-0003SH-Ml for help-gnu-emacs@gnu.org; Fri, 15 Aug 2008 03:38:03 -0400 Original-Received: from [199.232.76.173] (port=53259 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTtso-0003SA-GP for help-gnu-emacs@gnu.org; Fri, 15 Aug 2008 03:38:02 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:5162) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KTtso-0007va-3h for help-gnu-emacs@gnu.org; Fri, 15 Aug 2008 03:38:02 -0400 Original-Received: from mtaout3.012.net.il ([84.95.2.7]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KTtsn-00026F-E1 for help-gnu-emacs@gnu.org; Fri, 15 Aug 2008 03:38:01 -0400 Original-Received: from HOME-C4E4A596F7 ([84.229.211.50]) by i_mtaout3.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0K5M007MIT7YFPV1@i_mtaout3.012.net.il> for help-gnu-emacs@gnu.org; Fri, 15 Aug 2008 10:38:23 +0300 (IDT) In-reply-to: <877iajck9s.fsf@sphinx.net.ru> X-012-Sender: halo1@inter.net.il X-detected-kernel: by mx20.gnu.org: Solaris 9.1 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56656 Archived-At: > From: Dmitry Dzhus > Date: Fri, 15 Aug 2008 02:19:11 +0400 >=20 > Ted Zlatanov wrote: >=20 > > This should decode to =D0=BD=D1=83=D0=BB=D1=8C but doesn't (I get= the same string instead): > > > > (decode-coding-string "=C3=AD=C3=AE=C3=AB=C3=BC" 'cp1251) > > > > Am I missing something obvious? Do I need to encode the string t= o > > something else? >=20 > 0. =C2=AB=C3=AD=C3=B3=C3=AB=C3=BC=C2=BB, not =C2=AB=C3=AD=C3=AE= =C3=AB=C3=BC=C2=BB That's not important, the original problem remains, even with a different spelling of the word. > 1. (decode-coding-string (string-make-unibyte "=C3=AD=C3=B3=C3=AB= =C3=BC") 'cp1251) Yes, that's it: decode-coding-string works reliably only on unibyte strings. In multibyte strings, random byte values will be interprete= d according to rules that are appropriate for Emacs internal representation of text in buffers and strings, not according to what we humans expect.