Unicode & Pythonwin / win32 / console?
kxroberto at googlemail.com
Tue Jan 10 10:40:01 CET 2006
Martin v. Löwis schrieb:
> Robert wrote:
> > I'm using Pythonwin and py2.3 (py2.4). I did not come clear with this:
> > I want to use win32-fuctions like win32ui.MessageBox,
> > listctrl.InsertItem ..... to get unicode strings on the screen - best
> > results according to the platform/language settings (mainly XP Home,
> > W2K, ...).
> Not sure what your question is - is there even a question in this
> paragraph? (notice I didn't understand the term "to come clear with")
> > Also unicode strings should be displayed as nice as possible at the
> > console with normal print-s to stdout (on varying platforms, different
> > windows/countries and linux, ...; I py2exe/cxfreeze apps) ...
> > Any hints how to do this and make it as complete and automated as
> > possible?
> No need to do anything - it should work out of the box.
hmm...? never got any non-questionable results:
PythonWin 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit
(Intel)] on win32.
Portions Copyright 1994-2004 Mark Hammond (mhammond at skippinet.com.au) -
see 'Help/About PythonWin' for further copyright information.
>>> import win32ui,glob
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode characters in position
12-16: ordinal not in range(128)
>>> print s
[on a WinXP Home - German; same with py2.3, win98, ... ]
The Windows Explorer displays correct cyrillic letters for this file
win32ui.MessageBox(s) seems to try ascii codec by default. But
mbcs/latin-1 (?) encoded 8bit strings like 'aousäöüß' (
=='aous\\xe4\\xf6\\xfc\\xdf' ) work (on this machine).
More information about the Python-list