all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Change encoding
@ 2009-08-07 17:50 Christophe Jorssen
  2009-08-07 19:15 ` Peter Dyballa
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christophe Jorssen @ 2009-08-07 17:50 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,

I'd like to know if it is possible to change the encoding of a buffer. 
For exemple, my buffer is encoded in ansinew and I'd like to recode it in 
utf-8.

And, by the way, is it possible to "read a file with this encoding", that 
is automatically convert the encoding of a file when opened (say the file 
is encoded in ansinew and I'd like to have it in my buffer encoded in 
utf-8).

I'm using 

GNU Emacs 23.1.50.1

(emacs-snapshot), under unbuntu.

Thanks a lot and sorry for my complete ignorance of the subject.

-- 
Christophe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change encoding
  2009-08-07 17:50 Change encoding Christophe Jorssen
@ 2009-08-07 19:15 ` Peter Dyballa
  2009-08-07 19:20 ` Eli Zaretskii
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2009-08-07 19:15 UTC (permalink / raw)
  To: Christophe Jorssen; +Cc: help-gnu-emacs


Am 07.08.2009 um 19:50 schrieb Christophe Jorssen:

> And, by the way, is it possible to "read a file with this  
> encoding", that
> is automatically convert the encoding of a file when opened (say  
> the file
> is encoded in ansinew and I'd like to have it in my buffer encoded in
> utf-8).


Look into the Options menu -> Mule -> Set Coding Systems!

File local variables can set an encoding:

	Comment mark(s) -*- mode: LaTeX; coding: utf-8; -*-

in the first six lines of the file (I think) or at the end:

	%%% Local Variables:
	%%% mode: latex
	%%% TeX-master: t
	%%% coding: utf-8-unix
	%%% TeX-command-default: "XeLaTeXx"
	%%% End:

'%%%' is the set of three TeX comment marks.

--
Greetings

   Pete

I love deadlines. I love the whooshing noise they make as they go by.
				– Douglas Adams







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change encoding
  2009-08-07 17:50 Change encoding Christophe Jorssen
  2009-08-07 19:15 ` Peter Dyballa
@ 2009-08-07 19:20 ` Eli Zaretskii
  2009-08-07 22:12 ` Xah Lee
  2009-08-08  9:44 ` Christophe Jorssen
  3 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2009-08-07 19:20 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Christophe Jorssen <christophe.jorssen@libre.fr.invalid>
> Date: 07 Aug 2009 17:50:59 GMT
> 
> I'd like to know if it is possible to change the encoding of a buffer. 
> For exemple, my buffer is encoded in ansinew and I'd like to recode it in 
> utf-8.

Type "C-x RET f utf-8 RET", and you are done.

> And, by the way, is it possible to "read a file with this encoding", that 
> is automatically convert the encoding of a file when opened (say the file 
> is encoded in ansinew and I'd like to have it in my buffer encoded in 
> utf-8).

No, it's not possible.  Emacs by preserves the encoding of the
original file, and it's easy enough to do what you want with the
command I show above.

Of course, you could also easily enough write a replacement for
find-file which does what you want automatically: change the value of
buffer-file-coding-system after you visit the file.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change encoding
  2009-08-07 17:50 Change encoding Christophe Jorssen
  2009-08-07 19:15 ` Peter Dyballa
  2009-08-07 19:20 ` Eli Zaretskii
@ 2009-08-07 22:12 ` Xah Lee
  2009-08-08  9:44 ` Christophe Jorssen
  3 siblings, 0 replies; 5+ messages in thread
From: Xah Lee @ 2009-08-07 22:12 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 7, 10:50 am, Christophe Jorssen
<christophe.jors...@libre.fr.invalid> wrote:
> Hello all,
>
> I'd like to know if it is possible to change the encoding of a buffer.
> For exemple, my buffer is encoded in ansinew and I'd like to recode it in
> utf-8.
>
> And, by the way, is it possible to "read a file with this encoding", that
> is automatically convert the encoding of a file when opened (say the file
> is encoded in ansinew and I'd like to have it in my buffer encoded in
> utf-8).
>
> I'm using
>
> GNU Emacs 23.1.50.1
>
> (emacs-snapshot), under unbuntu.
>
> Thanks a lot and sorry for my complete ignorance of the subject.

open the file, then call set-buffer-file-coding-system, then type the
encoding system you want. Type Tab to see a list of possible values.

this page might help:

• Emacs and Unicode Tips
  http://xahlee.org/emacs/emacs_n_unicode.html

you could also run a lisp program that changes all your files in a dir
to utf-8 or any other encoding. you could do this in python or elisp.

For python, see:

• Converting a File's Encoding with Python
  http://xahlee.org/perl-python/charset_encoding.html

for elisp, see:

• Emacs Lisp Examples
  http://xahlee.org/emacs/elisp_examples.html

look for the section to-unix-eol there.
You'll need to change the line

(set-buffer-file-coding-system 'unix)
to
(set-buffer-file-coding-system 'utf-8)

on linux, there's a command line tool iconv that does this as well.
Java solution is also there linked in the python page above.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Change encoding
  2009-08-07 17:50 Change encoding Christophe Jorssen
                   ` (2 preceding siblings ...)
  2009-08-07 22:12 ` Xah Lee
@ 2009-08-08  9:44 ` Christophe Jorssen
  3 siblings, 0 replies; 5+ messages in thread
From: Christophe Jorssen @ 2009-08-08  9:44 UTC (permalink / raw)
  To: help-gnu-emacs

Le Fri, 07 Aug 2009 17:50:59 +0000, Christophe Jorssen a écrit/wrote :

> Hello all,
> 
> I'd like to know if it is possible to change the encoding of a buffer.
> For exemple, my buffer is encoded in ansinew and I'd like to recode it
> in utf-8.

Thank you.

-- 
Christophe


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-08  9:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-07 17:50 Change encoding Christophe Jorssen
2009-08-07 19:15 ` Peter Dyballa
2009-08-07 19:20 ` Eli Zaretskii
2009-08-07 22:12 ` Xah Lee
2009-08-08  9:44 ` Christophe Jorssen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.