7

Windows 10, Emacs 25.

When I want to convert file from Windows-1251 to UTF-8 I use Notepad++.

Before convert:

enter image description here

convert:

enter image description here

after convert:

enter image description here

My question is: Is it possible this convert in Emacs?

6

One should use the command set-buffer-file-coding-system (C-x RET f), set the encoding, and then save the file.

  • 1
    This worked for me. It modified the buffer and I was able to save as UTF-8. – MattMS May 2 '18 at 2:50
4

The easiest way to do this is to:

  1. Type C-x RET c
  2. Select the desired coding system (in this case probably utf-8-dos)
  3. Pass C-x C-w as the command and pass the name of the file to write
  • Not help. File stay on "windows-1251" – Alex Aug 1 '17 at 16:10
  • @Alex sorry, I thought it was the other way around. I edited the answer to work for this case. – DoMiNeLa10 Aug 1 '17 at 18:45
  • 1
    I try again, but it not help. Coding system not change to utf-8-dos – Alex Aug 2 '17 at 7:03
1

This should do the trick:

  1. Visit the file with C-x C-f.
  2. Revert opened buffer to the original file encoding (cp-1251 in this case) with M-x + revert-buffer-wth-coding-system.
  3. Use M-x + set-buffer-file-coding-system to set encoding to utf-8.
  4. Save the file.
  • 1
    this answer is similar to @xji 's answer. – manandearth Dec 12 '18 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.