unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: ?manu* <paolNOini@math.SPAMunifi.it>
To: help-gnu-emacs@gnu.org
Subject: Re: switch between utf-8 and latin-1 (ARGH!!)
Date: Sat, 18 Jul 2009 21:06:43 +0200	[thread overview]
Message-ID: <Z2p8m.2447$vm5.478@tornado.fastwebnet.it> (raw)
In-Reply-To: <87vdlpdg9l.fsf@galatea.local>

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	other threads:[~2009-07-18 19:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-18 17:44 switch between utf-8 and latin-1 ?manu*
2009-07-18 17:59 ` Pascal J. Bourguignon
2009-07-18 19:06   ` ?manu* [this message]
2009-07-18 19:39     ` switch between utf-8 and latin-1 (ARGH!!) Anselm Helbig
2009-07-18 21:57       ` ?manu*
2009-07-18 23:54         ` Pascal J. Bourguignon
2009-07-19  6:32           ` ?manu*

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='Z2p8m.2447$vm5.478@tornado.fastwebnet.it' \
    --to=paolnoini@math.spamunifi.it \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).