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

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

Re: how to change file coding system


From: Peter Dyballa
Subject: Re: how to change file coding system
Date: Tue, 16 Aug 2005 13:20:00 +0200


Am 16.08.2005 um 11:22 schrieb Martin Monsorno:

,----
| monsorno@mmdev ~/work/workspace.c/gmx $ file bla*
| bla.eclipse: UTF-8 Unicode text
| bla.emacs:   ISO-8859 text
`----

Opening "bla.eclipse" with emacs, shows me the string
"�berfall".  Changing the file encoding with "C-x <RET> f
iso-latin-1-unix" and saving leads to:

The correct way would have been, once you've opened the file bla.eclipse and Emacs came up showing `-0:´ as start of the mode-line (stating ISO Latin-1 or ISO Latin-15 encoding), C-x <RET> r utf-8-unix <RET>: re-open the file in UTF-8 encoding, to view it in its natural mood.

When you now save the file in ISO Latin-1 encoding, having applied C-x <RET> f (set-buffer-file-coding-system), GNU Emacs does the conversion. Instead of C3 BC it writes only FC. The file size will be reduced by one byte.

The C-x RET commands *do not* change a buffer's (or a file's) contents, they just put some new skin on the buffer so that your view on the buffer's (i.e. file's) contents is adapted in a certain way: you can see a buffer's (or file's) whatever contents in green, blue, red, yellow, cyan ... utf-8, Mac-Roman, NeXT, koi-r8, euc-jp-unix ... encoding/view.


Eclipse might be fooling you. The character `ü´ is encoded in UTF-8 as C3 BC or, translating the two hex codes into ISO Latin-1 (or -15) characters, as: à ³. What you cite in your eMail, � or in HTML &iuml;&iquest;&frac12;, is *not* UTF-8.

--
Greetings

  Pete

"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
     -Benjamin Franklin, Historical Review of Pennsylvania.





reply via email to

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