From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: converting octal escape sequences to utf-8 and back Date: Sun, 29 May 2011 02:47:16 -0400 Message-ID: References: <19937.37639.583480.682350@gargle.gargle.HOWL> <87vcwuysgp.fsf@maru.md5i.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1306651648 19705 80.91.229.12 (29 May 2011 06:47:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 29 May 2011 06:47:28 +0000 (UTC) Cc: winkler@gnu.org, emacs-devel@gnu.org To: Michael Welsh Duggan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 29 08:47:20 2011 Return-path: Envelope-to: ged-emacs-devel@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 1QQZmS-0005zK-IG for ged-emacs-devel@m.gmane.org; Sun, 29 May 2011 08:47:20 +0200 Original-Received: from localhost ([::1]:52091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQZmS-00056G-70 for ged-emacs-devel@m.gmane.org; Sun, 29 May 2011 02:47:20 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQZmQ-00056B-Dp for emacs-devel@gnu.org; Sun, 29 May 2011 02:47:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQZmP-0007k5-Di for emacs-devel@gnu.org; Sun, 29 May 2011 02:47:18 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:56277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQZmP-0007k1-7g for emacs-devel@gnu.org; Sun, 29 May 2011 02:47:17 -0400 Original-Received: from eliz by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1QQZmO-0007Eq-G8; Sun, 29 May 2011 02:47:16 -0400 In-reply-to: <87vcwuysgp.fsf@maru.md5i.com> (message from Michael Welsh Duggan on Sun, 29 May 2011 01:40:54 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139871 Archived-At: > From: Michael Welsh Duggan > Date: Sun, 29 May 2011 01:40:54 -0400 > Cc: Roland Winkler > > As Leo says: > > (encode-coding-string "§" 'utf-8) > "\302\247" This is an illusion: what is produced are 2 bytes, but when Emacs inserts that into the buffer where the results are displayed, the bytes are represented as ASCII strings. Try writing the result to a file (e.g., with write-region) and you will see that what ends up in the file is simply the UTF-8 encoding of the character. This is not what the OP wanted. IOW, encode-coding-string produces the encoding specified by its 3rd argument, not its ASCII representation.