Emacs: Declare Encoding for a File
You can declare a file to be a specific encoding. 〔see Unicode: Character Set, Encoding, UTF-8, Codepoint〕
put this in the first line of the file:
-*- coding: utf-8 -*-
The line can start with a comment character of your language, such as
#
,
//
This magic line is also adopted by Ruby, Python.
;; -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
in emacs lisp packages, the first line is also used for declaring the package. but you can add the encoding line after it.
;;; xah-fly-keys.el --- ergonomic modal keybinding minor mode. -*- coding: utf-8; lexical-binding: t; -*-
Emacs and Unicode
- Emacs: Insert Unicode Character
- Emacs: Insert Emoji
- Emacs: Input Method
- Emacs: Get Character Info, Cursor Position
- Emacs Init: Update Unicode Data