I’ve finally gotten emacs working just the way I want with respect to UTF-8.
For entry of non-ascii characters, I most like RFC 1345. Emacs doesn’t have such an input system, and I don’t feel like writing one. screen, on the other hand, has support for digraph input, which will do the digraphs from RFC 1345 with the help of a little patch. (The same digraph input will also do any Unicode character if you know the hex for it, via the “U+xxxx” syntax.) Using screen instantly gives UTF-8 input support for pretty much every program I use.
The problem with this and Emacs is that if Emacs gets characters with the
high bit set, it treats that high bit as a meta key. This, of course,
breaks any method of inputting UTF-8 into emacs from an external source,
including cut-and-paste. I had to M-x customize-variable keyboard-coding-system
and set the coding system to utf-8. That
made UTF-8 work, but broke the meta key, since that was indeed how xterm
was sending it.
To fix xterm, I set this in my .Xresources:
XTerm*metaSendsEscape: true
to change the way Meta keys were sent (this also made meta work with a couple more programs, notably irssi). I also added this to my .xsession:
xmodmap -e "keysym Alt_L = Meta_L Alt_L"
xmodmap -e "keysym Alt_R = Meta_R Alt_R"
so that Meta would be bound to my Alt key. (It’s an IBM Model M keyboard—Alt is all I have. When I had a Windows key, it was bound as Meta.)