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

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

Re: problem with editing/decoding utf-8 text


From: Oliver Scholz
Subject: Re: problem with editing/decoding utf-8 text
Date: Fri, 23 May 2003 21:23:38 +0200
User-agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3.50 (windows-nt)

kai.grossjohann@gmx.net (Kai Großjohann) writes:

> Fery <engard.ferenc@innomed.hu> writes:
>
>> I have a UTF-8 text file, containing latin-1 text. When I try to edit it
>> with emacs, it does not detect that it is utf-8; the
>> describe-coding-system gives back 'iso-latin-1-unix'. (And I see the
>> two-byte representation of latin1 chars, which is not bad to me.)
>
> Released versions of Emacs put UTF-8 at a rather low priority for
> automatic encoding detection.  So you need to help Emacs by
> explicitly specifying the encoding.  Do C-x RET c utf-8 RET before
> using C-x C-f to open the file.
>
> You can also put utf-8 somewhat earlier in the list for automatic
> encoding detection.  I think this can be achieved in the following
> way, but I'm not sure.  I'm not a Mule expert.  If anyone knows
> better, please help out.
>
> (setq coding-category-list
>       (cons 'coding-category-utf-8
>             (delq 'coding-cateogcoding-utf-8
>                   coding-category-list)))
>

Not 100% if this really makes a difference --

(set-coding-priority (list 'coding-category-utf-8))

maybe?

If you want UTF-8 to be the default for new files:

(prefer-coding-system 'utf-8)

[...]
>> 1. Cannot I tell to a buffer (after the load of a file) that interpet it
>> as binary, and save exactly the same bytes what it did read into the
>> buffer (i.e. transparent buffer)?
>
> It's not a good idea.  The buffer contents might already be munged at
> that point.
[...]

Maybe the OP wants to visit files with `M-x find-file-literally'?

    Oliver
-- 
4 Prairial an 211 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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