[New-bugs-announce] [issue4787] Curses Unicode Support
Damian
report at bugs.python.org
Tue Dec 30 23:57:42 CET 2008
New submission from Damian <atagar1 at 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 <report at bugs.python.org>
<http://bugs.python.org/issue4787>
_______________________________________
More information about the New-bugs-announce
mailing list