urxvt & utf-8

Found an interesting problemo tonight with using vim in rxvt-unicode. Since the German umlauts and the old double-S (ä ö ü ß) are a bit tricky for me to make without a copy/pasting then where needed I usually use the alternative (ue oe ue ss) where possible. Since vim 7 has spell checking, I’ve got spelllang set to handle US and British english plus German in the spell checker. Which really works very nice because my spelling is a bit of a hodge podge for those ‘differences’ in English spelling.

While I was working on the translation last night, I employed both Vims spell checker and a translator program to help me with the grammer. Vims spell checker has the lovely ability of being able to correct things, taking the form I can easily get out of a US QWERTY board and replacing with the proper characters (ä ö ü ß), I knew there was some thing I loved about vim xD

The only thing is, trying to open the file again with vim caused it to display weird, all of the umlauts replaced with strange characters. I checked Vims idea of the files encoding and it was UTF-8, just like my system locale settings should be saying.

Yet, (n)vi, cat, and other utilities were showing them fine. Setting the terminal encoding in vim or launching it with LANG=de_DE.ISO8859-1 got them to display properly but still senseless :. My ~/.zshrc sets LANG to en_US.UTF-8, why nothing seemed to work right i dunno. Forcing urxvt (rxvt-unicode) to run with the C locale set (LC_CTYPE=”en_US.UTF-8″) got it working fine.

I’m not familiar with that end of C++ but I wouldn’t be surprised if it relied on the same setlocale() routine as C apps tend to. The FreeBSD handbook said to set LANG and MM_CHARSET and not LC_* variables for the environment. I’ve fixed it so the system kicks urxvt off with the right locale settings so the problem is fixed.

still a little odd imho lol