Martin Michlmayr wrote:
> Martin, can you please look into this?

Thomas is right: Python sets the locale first to "", then back
to "POSIX". This is intentional: it tries to obtain the CHARSET
during startup, but wants to leave locale control to the script.

So the test script has a bug: it should explicitly perform
setlocale (if ncurses requires that for proper operation).

I'll attach the corrected test script.

I then manually tried to link _curses.so with ncursesw,
and tried running the script, with no success. Investigating
further, it turns out that python links with readline,
and readline links with ncurses, not ncursesw. For some
reason, it is only svn trunk Python which links with
readline, not Debian python, so there is hope.

Regards,
Martin
#!/usr/bin/python
# -*- coding: utf-8 *-

import curses
import time
import locale
locale.setlocale(locale.LC_ALL, "")

a = 'Ä'
b = '•'
c = '人'
u_a = unicode(a, "utf-8")
u_b = unicode(b, "utf-8")
u_c = unicode(c, "utf-8")

print a
print u_a
print b
print u_b
print c
print u_c
time.sleep(3)

w = curses.initscr()
w.addstr('umlaut A: ' + a)
w.addstr("\n")
w.addstr('bullet: ' + b)
w.addstr("\n")
w.addstr("Chinese ren: " + c)
w.addstr("\n")
w.addstr("\n")

w.addstr('umlaut A: ' + u_a.encode("utf-8"))
w.addstr("\n")
w.addstr('bullet: ' + u_b.encode("utf-8"))
w.addstr("\n")
w.addstr("Chinese ren: " + u_c.encode("utf-8"))
w.addstr("\n")
w.addstr("\n")
w.refresh()
time.sleep(3)
curses.endwin()

Reply via email to