unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Anselm Helbig <anselm.helbig+news2009@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: switch between utf-8 and latin-1 (ARGH!!)
Date: Sat, 18 Jul 2009 21:39:32 +0200	[thread overview]
Message-ID: <87vdlpaih7.wl%anselm.helbig+news2009@googlemail.com> (raw)
In-Reply-To: <Z2p8m.2447$vm5.478@tornado.fastwebnet.it>

At Sat, 18 Jul 2009 21:06:43 +0200,
?manu* <paolNOini@math.SPAMunifi.it> wrote:
> 
> 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!

You don't need another editor to do that. Just try to understand what
emacs is doing here: when you added the line about the coding system
emacs understood that you want the contents of the buffer saved with
this coding system. Emacs can not know that the characters on screen
are not what you want! So you first have to get to the point where
Emacs has the correct notion about the coding system. Pascal already
pointed you to `set-buffer-file-coding-system', another way is to use
`universal-coding-system-argument' (C-x RET c) immediately before
opening a file.

HTH, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


  reply	other threads:[~2009-07-18 19:39 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   ` switch between utf-8 and latin-1 (ARGH!!) ?manu*
2009-07-18 19:39     ` Anselm Helbig [this message]
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=87vdlpaih7.wl%anselm.helbig+news2009@googlemail.com \
    --to=anselm.helbig+news2009@googlemail.com \
    --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).