12 Jul 2005 terceiro   » (Journeyer)

Bypassing bad (or null) UTF-8 support on text-mode applications

Well, I'm a big fan of text-mode applications like centericq, links, etc. But some time ago I decided to dive into UTF-8, but it caused me problems: those applications don't handle UTF-8 well yet. Since mutt handles UTF-8 very well, it wasn't that bas. But having to switch Gnome-Terminal tabs to iso-8859-1 encoding every time I wanted to use centericq or links was kind of annoying.

I've just found a workaround for this. It's not the final solution, but a nice temporary one while there are applications that don't "speak" UTF-8.

The secret is to use luit, a great utility that is already included in XFree86 distribution. luit converts the terminal I/O of between UTF-* and the current locale.

For example, :

As I do use an UTF-8 locale, what I have to do to make centericq run nice inside my UTF-8 terminal:

$ LANG=pt_BR.iso88591 luit centericq

Cool!

Now I have in my .bashrc:

  • alias links='LANG=pt_BR.iso88591 luit links'
  • alias centericq='LANG=pt_BR.iso88591 luit centericq'

BTW, Debian has a centericq-utf8 package, which doesn't work at all. That's not because of the packaging, but because centericq-utf8 doesn't use the right ncurses features to abstract the input encoding, what would make the simple fact of linking the application to libncursesw intead of the plain libncurses enough to make it UTF-8-aware.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!