0

Emacs 26.1, Windows 10

I open by Notedpad++ text file.

Here result: enter image description here

As you can see the encoded is UTF-8. And as result Notepad++ success show Cyrillic. Nice.

Now I open same file by Emacs: enter image description here

Why Emacs now show correct Cyrillic?

1

In my experience, this happens when Emacs ends up thinking that your file is not a text file but a binary file. This tends to happen when the file contains NUL bytes. Try C-s C-q 0 RET C-s to see if there's such a NUL byte somewhere.

You can also try C-x RET r utf-8 RET to reload the file as a utf-8-encoded file, just to make sure Emacs decodes it correctly when it's told which encoding to use (but it won't remember which encoding to use next time around, so it's not a real solution to your problem).

  • C-x RET r utf-8 RET - this help. How config Emacs to do this automatically? To open text file in UTF-8 encoding. In my init.el I set "(set-language-environment "UTF-8")" - but this not help. – Alexei Feb 11 at 14:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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