Saturday, July 02, 2005

UTF-8 success. Sort of.

I've just finished the bulk of the work that was needed to get aptitude working in UTF-8 locales. Unfortunately, I've run into a bit of a problem:



Notice what's happening with the drop-down menu: geometrically, it should obscure the right half of a Chinese character...but instead, that line of text is getting shifted to the right so that the Chinese character on the left is fully visible. Worse, the behavior here is unpredictable -- depending on the exact state of the display, it appears that curses will sometimes do the right thing and sometimes do a reasonable compromise (erasing the character that would be overlapped).

It seems that something lower down in the display hierarchy -- either curses or xterm -- doesn't like it when wide utf8 characters are partially overlapped by other characters. I suspect curses, because when I triggered drawing events in a different order (by selecting another menu and going back), I got correct output:



My best guess is that maybe curses' optimization algorithm doesn't understand what to do when a wide character is overlapped. Hopefully this will be acknowledged as a bug and fixed, because I really don't see how else to solve this without rewriting a lot of code.

0 Comments:

<< Home