0

I have this in my .emacs:

(setq-default buffer-file-coding-system 'utf-8-unix)

When I create a file in emacs and save it, it should be buffered and saved in utf-8-unix.

When I open such a file again after some time, the regional characters I had put in the file originally - å, ä and ö - will appear as capital A with tilde plus one of three cluttercharacters which I don't know the names of, a newlinesymbol, a sort of skull-symbol, and the yen-symbol.

Obviously, what I want is the original symbols when I reopen the file.

Why is this happening, how can I change that behaviour?

What I found in the documentation is the function (set-coding-systems-priority... but I'm not sure how to use it.

Also, second in that list is utf-8 (alias mule-utf-8), and first is iso-latin-1, which I assume is the system that is overriding my åäö's with clutter. Should I just change my default coding system from utf-8-unix to utf-8, if there's any difference. ?.

I'm a bit buffeled about all those coding issues in emacs...

Thanx for any enlightenment on the topic.

1 Answer 1

0

With M-x list-coding-systems you can list all the available encodings, seems that utf-8-unix is not one of them.

To properly set the default encoding system, state the following in your .emacs

(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)

More info in the emacs wiki on changing encodings and in Mastering Emacs.

1
  • utf-8-unix is a valid coding system. All coding systems can be of the form foo-unix or foo-dos or foo-mac, so list-coding-system doesn't list those variants.
    – Stefan
    Commented Jan 9, 2018 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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