From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: Convert UTF-8 Date: Wed, 17 Dec 2008 10:59:46 +0100 Message-ID: <87iqpjjf59.fsf@tux.homenetwork> References: <34c3af09-10d9-4b86-9683-08b37ccd4237@b41g2000pra.googlegroups.com> <1229480920.448497@arno.fh-trier.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1229508387 3220 80.91.229.12 (17 Dec 2008 10:06:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2008 10:06:27 +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 Dec 17 11:07:32 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 1LCtJI-0002zM-Jz for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 11:07:20 +0100 Original-Received: from localhost ([127.0.0.1]:44412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCtI6-0002TY-GC for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2008 05:06:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCtHR-0002TQ-8Y for help-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:05:25 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCtHP-0002TB-1m for help-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:05:23 -0500 Original-Received: from [199.232.76.173] (port=49995 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCtHO-0002T8-T7 for help-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:05:22 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:51327 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCtHO-0002Pu-6v for help-gnu-emacs@gnu.org; Wed, 17 Dec 2008 05:05:22 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LCtHL-00043q-8Y for help-gnu-emacs@gnu.org; Wed, 17 Dec 2008 10:05:19 +0000 Original-Received: from 167.211.85-79.rev.gaoland.net ([79.85.211.167]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2008 10:05:19 +0000 Original-Received: from thierry.volpiatto by 167.211.85-79.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2008 10:05:19 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 71 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 167.211.85-79.rev.gaoland.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:A80+9H2yRjePQMS+ZYUhvt/SayE= X-detected-operating-system: by monty-python.gnu.org: GNU/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:60720 Archived-At: YOUNG writes: > On Dec 16, 11:54 pm, Harald Hanche-Olsen wrote: >> + Andreas Politz : >> >> > YOUNG wrote: >> >> >> I have a Emacs 22.3.1 for Windows XP, and there is a file encoded in >> >> ASCII. I am trying to read the file and convert it to UTF-8 with >> >> emacs. >> >> > If I am not mistaken, converting a ASCII file to UTF-8 is an identity >> > operation, since the later is backwards compatible to the former. So >> > there would be nothing to convert. >> >> You are not at all mistaken of course, but many people take "ASCII" to >> mean their favourite eight bit character set (typically Latin 1 or 9 in >> western Europe). >> >> But since the OP reports no change to his files, maybe they really were >> proper ASCII to begin with. Or maybe he is confused about how to make >> emacs use UTF-8 when loading the file? If so, he could do worse than >> read the emacs info file, node "Recognize coding". >> >> -- >> * Harald Hanche-Olsen     >> - It is undesirable to believe a proposition >>   when there is no ground whatsoever for supposing it is true. >>   -- Bertrand Russell > > Well, I have no problem to load UTF-8 file with emacs at all. > > The problem is that emacs is not able to write UTF-8 at all. > > For example, if a file is encoded in ASCII (or, CP437, or ISO 8859 or > Latin 1 to 9; there are various aliases to indicating of it, but you > already know what it means.), I set it up with M-x set-buffer-file- > coding-system for writing utf-8 encoding. And, write (or save) it. > After that, exit the emacs and re-run it again, and try to read the > saved file to be expected UTF-8 encoding, but it reads again in ASCII. > It does not mean emacs can't read utf-8, but the file itself is not > encoded UTF-8. I check the file's encoding system with other > application like NotePAD++ or other editors, and all say the file is > still ASCII mode even though I write it as utf-8 in emacs. > > Again, there is no problem in reading utf-8. When a file is encoded > utf-8 correctly, emacs reads/writes it in utf-8. It's good. However, > emacs is not able to write utf-8 if the file is encoded in ASCII. It > only writes in ASCII encode no matter how I do "set-buffer-file-coding- > system" > > So, if somebody knows this issue and how to write utf-8 correctly when > a file is encoded in ISO8859 (or CP437 or ASCII), and if you share the > information, it would be appreciated. I was using iso-8859-15 before switching my system to utf-8. I just add to my files: (not -*- utf-8 encoding -*-) ,---- | # -*- coding: utf-8 -*- `---- instead of ,---- | # -*- coding: iso-8859-15 -*- `---- -- A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France