help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: switch between utf-8 and latin-1 (ARGH!!)


From: ?manu*
Subject: Re: switch between utf-8 and latin-1 (ARGH!!)
Date: Sat, 18 Jul 2009 21:06:43 +0200
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

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* <paolNOini@math.SPAMunifi.it> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]