Problem with curses and UTF-8

Ian Ward ian at excess.org
Tue Feb 7 15:42:26 EST 2006


When I run the following code in a terminal with the encoding set to
UTF-8 I get garbage on the first line, but the correct output on the second.


import curses
s = curses.initscr()
s.addstr('\xc3\x85 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE\n')
s.addstr('\xc3\xa5 U+00F5 LATIN SMALL LETTER O WITH TILDE')
s.refresh()
s.getstr()
curses.endwin()


I tested with gnome-terminal, Python 2.4 and Ubuntu breezy.  The output
is correct when I run the following code:


print '\xc3\x85 U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE'
print '\xc3\xa5 U+00F5 LATIN SMALL LETTER O WITH TILDE'


Any Ideas?

Ian Ward





More information about the Python-list mailing list