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

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

Re: Problem with coding system and emacsclient


From: Oliver Scholz
Subject: Re: Problem with coding system and emacsclient
Date: Sat, 21 Aug 2004 12:55:42 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt)

Unfortunately I am right now doomed to work on the operating system
that dare not say its name; I can't make any test with emacsclient.
So I am probably not the right person to answer your question right
now. However, since nobody else has replied so far, I might as well
try my best.

Juraj Kubelka <Juraj.Kubelka@email.cz> writes:

> Hi!
>
> I have problem with opening files with emacsclient in different
> coding.
>
> My default coding system is:
>
> ------- M-x describe-coding-system RET RET
> Coding system for saving this buffer:
>   2 -- iso-8859-2 (alias of iso-latin-2)
[...]

> Priority order for recognizing coding systems when reading files:
>   1. iso-8859-2 (alias of iso-latin-2)
>   2. iso-latin-1 (alias: iso-8859-1 latin-1)
>   3. iso-2022-jp (alias: junet)
>   4. iso-2022-7bit 
>   5. iso-2022-7bit-lock (alias: iso-2022-int-1)
>   6. iso-2022-8bit-ss2 
>   7. emacs-mule 
>   8. raw-text 
>   9. japanese-shift-jis (alias: shift_jis sjis)
>   10. chinese-big5 (alias: big5 cn-big5)
>   11. no-conversion (alias: binary)
>   12. mule-utf-8 (alias: utf-8)


> I can open file with coding system cp1250:
>
> C-x RET c cp1250-unix RET C-x C-f file_coding.txt
>
> Everything is correct. Now I save and close file.
>
> I can open file again with same sequence above. But when I want open
> file with emacsclient I cannot use prefix "C-x RET c cp1250-unix RET"
> and file is opened in "Unibyte raw-coding".
[...]

> Characters are strange of course. I can use "C-x RET f cp1250-unix
> RET" and file is now opened in "Unibyte cp1250-unix". 

When the character encoding scheme has not been properly detected on
visiting the file, then it's too late to do `C-x RET f'. Recent CVS
Emacs provides the command 
`C-x RET r' (`revert-buffer-with-coding-system') which, erm, reverts
the buffer with a different coding system.

[...]
> Do you have any solution for it? How open file in different coding with
> emacsclient (I know coding of file)?

It would be nice, if emacsclient had some sort of --encoding option to
specify the encoding on the command line (but maybe it does? Have you
checked?). Failing that I can think of two ways to get what you want:

The best way is probably to put a coding system cookie into the file:

At the beginning:


-*- coding: windows-1250 -*-


At the end:


Local Variables:
coding: windows-1250
End:


See (info "(emacs)Recognize Coding").


Another way would be to frob the coding system priorities:

;; Move windows-1250 (aka cp1250) to front.
(prefer-coding-system 'windows-1250)

;; Move Latin-2 to front again, because that's what is actually
;; prefered.
(prefer-coding-system 'iso-latin-2)


    Oliver
-- 
4 Fructidor an 212 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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