Hello,
what is the proper way to handle Unicode/UTF-8 and wxPython? What will
be the proper way in the future (Python3/wxPython Phoenix)? As an
example see the following file:
When running the following .py-File (encoded in UTF-8 with strings
prefixed with and without u'')
http://pastebin.com/2wVAUzfU
in different ways, different results are achieved (running on python
2.7.2/wxPython 2.8.12.1-unicode) on WindowsXP SP3 with Luna theme (the
one with the slightly rounded buttons and colored edge).
1) Running the Code from Eclipse/PyDev
German Umlaute/chinese characters are displayed properly in all cases
(regardless of string prefix)
The XP theme is presented properly
2) Running the .py-File from cmd or by double-clicking in the Explorer
Only the u''-prefixed strings are shown properly, the not prefixed
strings are shown as two garbled characters
The XP theme is presented properly
3) Creating an exe with GUI2exe/py2exe *without* XP Manifest
like 2), and the Button Theme is now Windows Standard (like Win2000/
Server 2003 with grey border
4) Creating an exe with GUI2exe *with* Include XP Manifest checked
The generated .exe crashes (sorry, german: "Die Anwendung konnte nicht
initialisiert werden (0xc0000142)..."
5) Replacing the manifest:
According to Werner Bruhin/Cody Precord the manifest in GUI2exe
Constants.py
http://code.google.com/p/gui2exe/source/browse/trunk/Constants.py
can be replaced by the one from
http://wiki.wxpython.org/py2exe-python26
Result: EXE works, optical result like 2)
Questions:
Do I have now to prefix all strings containing special characters with
u'' additionally to having specified
# -*- coding: utf-8 -*-
in the file header?
How has it to be done in the future in Python3/Phoenix?
With thanks in advance,
nepix