python+ncurses: I can't display accents

Neil Cerutti horpner at yahoo.com
Fri Jan 26 15:25:28 EST 2007


On 2007-01-26, Fabrice DELENTE <fdelente at mail.cpod.fr> wrote:
>> What have you tried?
>
> I've tried
>
> stdscr.addstr(0,0,"aéïoù")
>
> or
>
> stdscr.addstr(0,0,"leçon")
>
> The ASCII chars show correctly, but the accented characters
> don't, so I see 'ao' or 'leon' on the screen.
>
> The term in which I display is 8-bit-able, so the problem is
> either on ncurses side, or on python side.

What happens when you try this?

stdscr.addstr(0,0, u"leçon".encode('iso8859-15'))

I don't really expect it to work, but if anything will, that is
it. Curses supports only ASCII and a some special symbol codes
defined by curses.

> I have
>
> #!/usr/local/bin/python
> #coding: iso8859-15

Be sure to write your non-ASCII strings as unicode literals, and
then encode them just before displaying or storing them
somewhere.

-- 
Neil Cerutti

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list