I'm using a ListCtrl in Report mode with a ColumnSorterMixin, as in the wxPython-demo !
The problem it's that i use row values with unicode strings and ColumnSorterMixin fails and dump this
when i try to column-sort-them:
if type(item1) == type('') or type(item2) == type(''):
File
"/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/lib/mixins/listctrl.py",
line 132, in __ColumnSorter cmpVal = locale.strcoll(str(item1),
str(item2)) UnicodeEncodeError: 'ascii' codec can't encode character
u'\xed' in position 10: ordinal not in range(128)
I'm using a ListCtrl in Report mode with a ColumnSorterMixin, as in the wxPython-demo !
The problem it's that i use row values with unicode strings and ColumnSorterMixin fails and dump this
when i try to column-sort-them:
if type(item1) == type('') or type(item2) == type(''):
File
"/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/lib/mixins/listctrl.py",
line 132, in __ColumnSorter cmpVal = locale.strcoll(str(item1),
str(item2)) UnicodeEncodeError: 'ascii' codec can't encode character
u'\xed' in position 10: ordinal not in range(128)
What can i do ?
It looks like your encoding is set to the default "ascii", I don't use Unicode but support French and German by using ISO8859 and for that to work I do the following at the beginning of my wx.App script.
import sys
if hasattr(sys, "frozen"): #Py2Exe does not run Site.py
sys.setdefaultencoding('iso-8859-1')
else: #The Python interpreter needs to reload the function
reload(sys)
sys.setdefaultencoding('iso-8859-1')
del sys.setdefaultencoding
I also do this for gettext support and to make controls such as the wx.lib.masked to work correctly.
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
On Wed, 28 Jun 2006 19:20:04 +0200 "Werner F. Bruhin" <werner.bruhin@free.fr> wrote:
It looks like your encoding is set to the default "ascii", I don't use
Unicode but support French and German by using ISO8859 and for that to
work I do the following at the beginning of my wx.App script.