22 Apr 2008 17:08
utf8 and curses/urwid
Erik Osheim <erik <at> plastic-idolatry.com>
2008-04-22 15:08:58 GMT
2008-04-22 15:08:58 GMT
Hey Ian, So, I have been developing an emacs-like, curses-based editor in python (Pmacs[1]) for a couple of years now (which I do all my work in at this point). After much reflection, I realized that I should actually try to support Unicode so that non-English speakers would have the option to use it. This may have been a mistake. I've seen some emails you sent around 2006 detailing problems you found with Python's curses bindings. I'm running into some of those same problems now. However, based on the version of Urwid I have installed (0.9.7.1) it seems like you have it figured out... my test[2] shows both the "print" and the "urwid" case working, whereas the "curses" case falls down. I read Urwid's curses_display module, but I didn't see anything substantially different in your use of curses from mine. Do you have any advice (other than giving up on curses and using Uriwd[3])? I noticed you still have disclaimers about UTF-8 on your main page--what is the state of the curses module in your opinion? Thanks, -- Erik [1] http://www.bearhome.net/pmacs [2] Attached script, run under python 2.4.4 and 2.6a2 on xterm (with UTF8 enabled). curses module linked to ncursesw (for what it's worth). LANG=en_US.utf8, TERM=xterm.(Continue reading)
The problem I've run into is that you can't rely on your users' version
of Python having been linked against ncursesw (the one that works with
UTF8 and other interesting encodings.) This was one of the reasons I
started work on the raw_display module.
raw_display just assumes a basic subset of terminal escape sequences and
tosses them at stdout. It's hackish, but it avoids problems like the
one you're running into as well as TERM misconfiguration or missing
termcap entries.
RSS Feed