I want to change my default encoding system from non defined to UTF-8 (I think that would be useful). Now I have seen many different UTF-8 coding systems:

mule-utf-8        mule-utf-8-dos
mule-utf-8-mac    mule-utf-8-unix
prefer-utf-8      prefer-utf-8-dos
prefer-utf-8-mac  prefer-utf-8-unix
utf-8             utf-8-auto
utf-8-auto-dos    utf-8-auto-mac
utf-8-auto-unix   utf-8-dos
utf-8-emacs       utf-8-emacs-dos
utf-8-emacs-mac   utf-8-emacs-unix
utf-8-hfs         utf-8-hfs-dos
utf-8-hfs-mac     utf-8-hfs-unix
utf-8-mac         utf-8-unix
utf-8-with-signature     utf-8-with-signature-dos
utf-8-with-signature-mac utf-8-with-signature-unix

I am using a Mac and I am further confused about these different hfs and mac coding systems.

At the moment I decided to use utf-8 as follow based on this answer:

(setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
(set-language-environment 'utf-8)
;; (set-keyboard-coding-system 'utf-8-mac) ; For old Carbon emacs on OS X only
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(unless (eq system-type 'windows-nt)
  (set-selection-coding-system 'utf-8))
(prefer-coding-system 'utf-8)

But I would like to understand some more what I am doing and why another utf-8 would be better as a default coding system?

  • 2
    This answer provides good background on different utf-8 variants.
    – Juancho
    Jun 30, 2015 at 14:01
  • I don't see utf-8-hfs and friends on my emacs, but there is utf-8-nfd instead. That is the encoding used by OS X to encode filenames. NFD is for Normalized Form Canonical Decomposition. NFC is more commonly used (C is for Composition). One difference is that a letter like å is encoded as a single code point in NFC, but two in NFD (the letter a followed by a composing character for the ring above). You should probably forget about these encodings; just hope that filenames are automagically encoded correctly anyhow. Jul 1, 2015 at 11:01
  • 1
    Yes, I try stick to ASCII for filenames myself, as I live in a multi-OS world and rely on all sorts of synchronization tools that I don't trust to deal with anything else. But it is annoying not to be able to use blåbærsyltetøy as part of a filename. 8-) Jul 1, 2015 at 14:15
  • 2
    AFAIK, utf-8 is the coding system used under macos for most things, and Emacs should already pick its coding systems accordingly for you. IOW, I think you should need no configuration at all. Please clarify why you "want to change my default encoding system". Maybe you're simply hitting an Emacs bug.
    – Stefan
    Nov 27, 2017 at 16:20
  • 1
    Back when Macs used MacOS (which was before they used OSX which was before they used MacOS; yay naming), the end-of-line syntax on Macs was a single carriage return. That's what the -mac suffix'd coding system variants are for (ever since those days). Nowadays, since Macs started using OSX and subsequently MacOS (yay naming) the EOL syntax is (I believe) a single line feed, which is the -unix suffix/variant. I imagine the "will pick the correct variant" advice is sound, though.
    – phils
    Jul 30, 2023 at 12:15

1 Answer 1


Emacs has [Menu]->[Options]->[Multilingual Environment]->[Describe Coding System...] or C-h C to explain the difference and disambiguate the different coding systems.

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.