unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: Problem with coding system and emacsclient
Date: Sat, 21 Aug 2004 12:55:42 +0200	[thread overview]
Message-ID: <un00ohia9.fsf@ID-87814.user.uni-berlin.de> (raw)
In-Reply-To: mailman.1886.1092903443.2011.help-gnu-emacs@gnu.org

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	other threads:[~2004-08-21 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1886.1092903443.2011.help-gnu-emacs@gnu.org>
2004-08-21 10:55 ` Oliver Scholz [this message]
2004-08-23 16:46   ` Problem with coding system and emacsclient Kevin Rodgers
2004-08-31 12:33     ` Juraj Kubelka
     [not found]     ` <mailman.849.1093955960.1998.help-gnu-emacs@gnu.org>
2004-09-01  2:55       ` Edward Casey
2004-08-19  8:12 Juraj Kubelka

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=un00ohia9.fsf@ID-87814.user.uni-berlin.de \
    --to=alkibiades@gmx.de \
    /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).