[Urwid] Weird LineBox behavior

Ian Ward ian at excess.org
Fri Jun 1 23:11:07 EDT 2007


John Powell wrote:
> I recently tried running an urwid app I had written on a 2.6 kernel (was
> testing on 2.4) and realized some strange behavior from the LineBox control.
> 
> Where I expect to see a solid line surrounding the frame I have wrapped
> instead I see a sequence of letters.. 'q' for the upper and lower bounding
> region, 'x' on the left and right side and starting from the left top corner
> and moving to the right the letters 'l', 'k', 'm', 'j'. To illustrate it
> looks like this...
> 
> lqqqqqqqqqqqqqqqk
> x               x
> x               x 
> x               x 
> mqqqqqqqqqqqqqqqj
> 
> It seems to be that there is a problem with the utf8decode function but I am
> not sure how to diagnose and fix the problem. Any ideas?

When Urwid thinks that it is not running with a UTF-8 encoding it will 
use the "alternate character set" escape sequences to draw certain 
graphic characters.  If your terminal is not set up to interpret these 
escape sequences it will display the characters as the letters you show 
above.  Most terminals that I have tested will display the proper 
character when the alternate character set escape sequences are used.

What terminal do you notice the problem in (or is it the Linux console, 
since you mention upgrading your kernel)?  What is your $LANG setting?

Ian




More information about the Urwid mailing list