Just resolved the issue (turned out to be an issue with linked ncurses libraries). If others run into this discussion of the solution can be found at: http://bugs.python.org/issue4787
Cheers! -Damian On Mon, Dec 29, 2008 at 10:30 PM, Damian Johnson <atag...@gmail.com> wrote: > It seems as if the curses module in Python 3.0 isn't respecting the > system's preferred encoding (utf-8) which was set via: > locale.setlocale(locale.LC_ALL, '') > > The purpose of this was described at the top of ' > http://docs.python.org/dev/3.0/library/curses.html#module-curses'. The > getlocale function is reporting the proper values ('en_US', 'UTF8') but > addstr is clearly not treating it as Unicode - is this a bug? -Damian > > 2008/12/28 Damian Johnson <atag...@gmail.com> > > Hi, I've switched to Python 3.0 for a new Japanese vocab quizzing >> application due to its much improved Unicode support. However, I'm running >> into an issue with displaying Unicode characters via curses. In Python 2.x a >> simple hello-world looks like: >> >> #!/usr/bin/python >> # coding=UTF-8 >> >> import curses >> import locale >> >> locale.setlocale(locale.LC_ALL,"") >> >> def doStuff(stdscr): >> message = u"hello わたし!" >> stdscr.addstr(0, 0, message.encode("utf-8"), curses.A_BLINK) >> stdscr.getch() # pauses until a key's hit >> >> curses.wrapper(doStuff) >> >> This works. However, when I try to come up with an equivalent for Python >> 3.0: >> >> #!/usr/bin/python >> >> import curses >> import locale >> >> locale.setlocale(locale.LC_ALL,"") >> >> def doStuff(stdscr): >> message = "hello わたし!" >> stdscr.addstr(0, 0, message, curses.A_BLINK) >> stdscr.getch() # pauses until a key's hit >> >> curses.wrapper(doStuff) >> >> It fails (printing gibberish to the console). Anyone have a clue what I'm >> doing wrong? Thanks! -Damian >> >> PS. Is the "# coding=UTF-8" header meaningless in Python 3.0? Also, is >> "locale.setlocale(locale.LC_ALL,"")" still necessary for getting curses to >> provide Unicode support? >> >> >
-- http://mail.python.org/mailman/listinfo/python-list