> 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
> 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
> I'm using
> GNU Emacs 126.96.36.199
> (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
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
for elisp, see:
• Emacs Lisp Examples
look for the section to-unix-eol there.
You'll need to change the line
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.