how to pbpaste UTF-8 characters in GNU Emacs for O

2019-06-06 15:50发布

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.

标签: emacs utf-8
1条回答
趁早两清
2楼-- · 2019-06-06 16:51

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")
查看更多
登录 后发表回答