New submission from Damian <atag...@gmail.com>: Hi, in switching to Python 3.0 I've run 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). It seems that the problem is that the curses module isn't respecting the system's preferred encoding (utf-8) which was set via the setlocale function (as per instructions at http://docs.python.org/dev/3.0/library/curses.html#module-curses). My apologies in advance if this is my mistake. Cheers! -Damian ---------- components: Unicode messages: 78563 nosy: atagar1 severity: normal status: open title: Curses Unicode Support type: behavior versions: Python 3.0 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4787> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com