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

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

Re: Convert UTF-8


From: YOUNG
Subject: Re: Convert UTF-8
Date: Wed, 17 Dec 2008 00:41:47 -0800 (PST)
User-agent: G2/1.0

On Dec 16, 11:54 pm, Harald Hanche-Olsen <han...@math.ntnu.no> wrote:
> + Andreas Politz <poli...@fh-trier.de>:
>
> > 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     <URL:http://www.math.ntnu.no/~hanche/>
> - 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.

Thanks,


reply via email to

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