9

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?

  • 1
    This answer provides good background on different utf-8 variants. – Juancho Jun 30 '15 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. – Harald Hanche-Olsen Jul 1 '15 at 11:01
  • @Juancho Thanks - so I assume that, that I am OK when I use the utf-8 as a general setting. Thanks. – Rainer Jul 1 '15 at 12:19
  • @HaraldHanche-Olsen OK - As I am only using ASCII for file names, I should be OK then. Thanks. – Rainer Jul 1 '15 at 12:19
  • 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-) – Harald Hanche-Olsen Jul 1 '15 at 14:15
0

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 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.