From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ?manu* Newsgroups: gmane.emacs.help Subject: Re: switch between utf-8 and latin-1 (ARGH!!) Date: Sat, 18 Jul 2009 21:06:43 +0200 Message-ID: References: <1Sn8m.2418$vm5.686@tornado.fastwebnet.it> <87vdlpdg9l.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1247946526 12782 80.91.229.12 (18 Jul 2009 19:48:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Jul 2009 19:48:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 18 21:48:39 2009 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 1MSFtf-00029J-40 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Jul 2009 21:48:39 +0200 Original-Received: from localhost ([127.0.0.1]:46432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MSFte-0000bm-E7 for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Jul 2009 15:48:38 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!goblin1!goblin.stu.neva.ru!tiscali!newsfeed1.ip.tiscali.net!tornado.fastwebnet.it!53ab2750!not-for-mail User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) Original-Newsgroups: gnu.emacs.help In-Reply-To: <87vdlpdg9l.fsf@galatea.local> Original-Lines: 47 Original-NNTP-Posting-Host: 27.243.168.45 Original-X-Complaints-To: newsmaster@fastweb.it Original-X-Trace: tornado.fastwebnet.it 1247943993 27.243.168.45 (Sat, 18 Jul 2009 21:06:33 CEST) Original-NNTP-Posting-Date: Sat, 18 Jul 2009 21:06:33 CEST Original-Xref: news.stanford.edu gnu.emacs.help:171022 X-Mailman-Approved-At: Sat, 18 Jul 2009 15:47:15 -0400 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:66209 Archived-At: Thank you so much. I have spent maybe one or two hours to understand what was happening to my buffers. I tell you because it's a little bit funny. I open my buffer with UTF-8 encoding, and i see all the multibyte characters scrambled. Then I insert the line -*- coding:utf-8 -*- at the beginning and I save the buffer. Then I exit emacs and reopen the buffer. Apparently nothing has changed. What was happening was that after I write that line on the buffer, when I save the buffer emacs converted the utf-8 escape characters in utf-8 (this seems a wrong behaviour to me!). Looking with hexdump I can see that the original two bytes characters become four bytes. The only solution I found was to use another editor to insert that line!!! This is awkward! E. Pascal J. Bourguignon ha scritto: > ?manu* writes: > >> . what method does emacs use to guess the encoding of a text file? >> >> . what is the command to tell emacs that the file in the buffer is >> utf-8 instead of latin-1? > > M-x set-buffer-file-coding-system > (Usually bound to C-x RET f) > > >> . is it possible to insert some text in the file (in comments) >> to tell emacs which encoding to use? > > Insert the coding File Variable: > > Put: -*- coding:utf-8; -*- > on one of the first two lines, > > or put: > > Local Variables: > coding: utf-8 > End: > > in the last 512 bytes of the file. >