I'm in GNU Emacs on OSX. I have copied a line of UTF-8 characters to the Clipboard from Google Chrome. In Emacs eshell-mode, when I do pbpaste
, I get garbage characters. How do I correctly paste UTF characters into my Emacs? My coding system is already specified as UTF-8.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
pbpaste
uses your current locale environment variables for input/output encoding (this is explained in the man page).
I copied a line of accented characters from your referenced file, tried the following with success:
$ LANG=en_US.UTF-8 pbpaste
u00C0: À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ
This means that eshell is starting with no LANG
environment variable set, and if you provide a value, it works OK.
Add this to your Emacs setup, or type it into eshell:
(setenv "LANG" "en_US.UTF-8")