From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: decode-coding-region returns octal escapes Date: Tue, 10 Feb 2009 15:55:12 +0900 Message-ID: References: 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 1234248936 20842 80.91.229.12 (10 Feb 2009 06:55:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Feb 2009 06:55:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 10 07:56:51 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LWmY3-0007nQ-Kc for ged-emacs-devel@m.gmane.org; Tue, 10 Feb 2009 07:56:47 +0100 Original-Received: from localhost ([127.0.0.1]:60229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWmWj-0005lR-T5 for ged-emacs-devel@m.gmane.org; Tue, 10 Feb 2009 01:55:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LWmWe-0005lM-Mq for emacs-devel@gnu.org; Tue, 10 Feb 2009 01:55:20 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LWmWd-0005lA-5H for emacs-devel@gnu.org; Tue, 10 Feb 2009 01:55:20 -0500 Original-Received: from [199.232.76.173] (port=37738 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWmWc-0005l7-Vm for emacs-devel@gnu.org; Tue, 10 Feb 2009 01:55:19 -0500 Original-Received: from mx1.aist.go.jp ([150.29.246.133]:52565) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LWmWZ-0002dt-LB; Tue, 10 Feb 2009 01:55:16 -0500 Original-Received: from rqsmtp1.aist.go.jp (rqsmtp1.aist.go.jp [150.29.254.115]) by mx1.aist.go.jp with ESMTP id n1A6tDkJ023109; Tue, 10 Feb 2009 15:55:13 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp1.aist.go.jp by rqsmtp1.aist.go.jp with ESMTP id n1A6tDx0016895; Tue, 10 Feb 2009 15:55:13 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp1.aist.go.jp with ESMTP id n1A6tAF0004434; Tue, 10 Feb 2009 15:55:10 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken with local (Exim 4.69) (envelope-from ) id 1LWmWW-0005f8-Is; Tue, 10 Feb 2009 15:55:12 +0900 In-reply-to: (message from Eli Zaretskii on Sat, 07 Feb 2009 14:00:57 +0200) X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.aist.go.jp id n1A6tDkJ023109 X-detected-operating-system: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108929 Archived-At: In article , Eli Zaretskii writes: > To reproduce: > emacs -Q > M-x find-file-literally RET etc/tutorials/TUTORIAL.de RET > (The German tutorial is just an example, you can use any one, but > others might need different values of the 3rd argument to > decode-coding-region below.) > Now mark a region that includes non-ASCII characters, for example, > this one, on line 7 of the file: > da\337 die CONTROL-Taste gedr\374ckt sein mu\337 > and type > M-: (decode-coding-region (mark) (point) 'latin-1 t) RET > The result is that the echo area shows this: > #("da\337 die CONTROL-Taste gedr\374ckt sein mu\337" 0 39 (charset = iso-8859-1)) > and the *Messages* buffer shows this: > #("da\303\237 die CONTROL-Taste gedr\303\274ckt sein mu\303\237" 0 = 39 (charset iso-8859-1)) > But I expected to see this in both cases: > #("da=C3=9F die CONTROL-Taste gedr=C3=BCckt sein mu=C3=9F" 0 39 (ch= arset iso-8859-1)) At least decode-coding-string is working correctly. Please try this instead: M-: (setq str (decode-coding-region (mark) (point) 'latin-1 t)) RET C-h v str RET You'll see the correct multibyte string. > Is this a bug? If not, what is the explanation for what I see? Why > are raw bytes inserted instead of decoded characters? It seems that `message' function somehow uses enable-multibyte-characters of the current buffer to decide how to show a string. When I do this after the above C-h v: M-: (message "%s" str) RET I see those octals, but when I do that while I'm in a multibyte buffer, I see correct characters. --- Kenichi Handa handa@m17n.org