jeudi 31 juillet 2008

How to convert a file to a specific coding system without the help of iconv

I've once had a problem with coding system. I inadvertently inserted an euro (€) sign into a classic (Unix) buffer, and when I asked emacs to save it, it told me that the coding system I was using was not able to save correctly my buffer.

I saved it using UTF-8, but after that, when I opened the file, Emacs was unable to guess that it was UTF-8.

I found a little command set-buffer-file-coding-system that you can call by C-x RET f that allow me to specify which coding system I want to use for the current buffer and file. This is not like reverting to a specific coding system, no, emacs is really converting the file and each and every character in it to the coding system I want.

That way, I then save the file with the correct coding system, emacs having done the conversion.

Aucun commentaire: