7

Windows 10 (64 bit), Emacs 25.1

I want when I save any file to save them (by default) with coding system = UTF-8.

So In my init.el I has :

(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-language-environment 'utf-8)
(set-selection-coding-system 'utf-8)

But it not help. When I try to save file (C-x C-s) Emacs prompt me: "Select coding system"

  • 1
    What is the type/mode of the file you are saving? Having you tried this with just emacs -Q? I just have (prefer-coding-system 'utf-8-unix) in my config (Windows 10, Emacs 25.2) and it works fine. Your code also seems fine, so it is likely something else. – Reign of Error Jul 21 '17 at 10:39
  • Type mode is Text because file is myfile.txt. I try this (prefer-coding-system 'utf-8-unix) - but it not help. I try emacs -Q but it also ask me "Select coding system". – Alex Jul 21 '17 at 11:49
  • That is strange. What language is Windows 10 configured to use - for input etc - and what kind of characters (e.g. Latin, Cyrillic, Chinese) does your text file contain? PS. I didn't mean to suggest you should use 'utf-8-unix, utf-8 should be fine. – Reign of Error Jul 21 '17 at 13:14
  • Also - what does "myfile.txt" contain? Text you typed in? Nothing? Text pasted in? – Reign of Error Jul 21 '17 at 13:23
0

This does it for me:

(set-language-environment "UTF-8")

See here.

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.