How to get support for '✖' and the like in the Emacs shell buffer?
To tell an individual shell buffer to treat the output from the shell as UTF-8, issue the command C-x RET p, and type "utf-8" when asked "Coding system for output from the process: ". When then asked "Coding-system for input to the process: ", I just type RET; I never provide UTF-8 input directly to the shell.
Alternately, to get this behavior automatically, put (prefer-coding-system 'utf8)
in your .emacs
file. Actually, that will cause UTF-8 to be used in some other contexts as well, which is what most people would probably want.
You could call a function like the following one to create a shell that supports utf-8:
(defun utf8-shell () "Create Shell that supports UTF-8." (interactive) (set-default-coding-systems 'utf-8) (shell))
This sets both input and output to UTF-8 so you can do (for example) the following:
~ $ echo "✖"✖
If you want to make shell always open with utf-8 support, you can do the following instead:
(defadvice shell (before advice-utf-shell activate) (set-default-coding-systems 'utf-8))(ad-activate 'shell)