forked from Superbil/old-emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-locales.el
22 lines (19 loc) · 927 Bytes
/
init-locales.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(defun sanityinc/utf8-locale-p (v)
"Return whether locale string V relates to a UTF-8 locale."
(and v (string-match "UTF-8" v)))
(defun locale-is-utf8-p ()
"Return t iff the \"locale\" command or environment variables prefer UTF-8."
(or (sanityinc/utf8-locale-p (and (executable-find "locale") (shell-command-to-string "locale")))
(sanityinc/utf8-locale-p (getenv "LC_ALL"))
(sanityinc/utf8-locale-p (getenv "LC_CTYPE"))
(sanityinc/utf8-locale-p (getenv "LANG"))))
(when (or window-system (locale-is-utf8-p))
(setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
(set-language-environment 'utf-8)
(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))
(provide 'init-locales)