Unicode problem on copy
Federico Fanton <[email protected]>
| Newsgroups | gmane.comp.python.wxglade |
|---|---|
| Message-ID | <[email protected]> |
Hi everyone!
I'm using the latest wxGlade from BitBucket (branch 0.7.0) and I'm
getting an error when I try to copy something that contains a non-ASCII
character.
Here's what wxGlade is logging:
2015-01-13 12:24:19,008 root ERROR: An unhandled exception occurred
An unexpected error occurred!
Date and time: 2015-01-13T12:24:19.008869
Python version: 2.7.3
wxPython version: 2.8.12.1
wxWidgets platform: __WXGTK__
wxGlade version: 0.7.0
Language code: en_US
Encoding: UTF-8
Filesystem encoding: UTF-8
Exception type: <type 'exceptions.UnicodeEncodeError'>
Exception details: 'ascii' codec can't encode character u'\xe0' in
position 127: ordinal not in range(128)
Application stack trace:
Stack frame at level 0
======================
File "/home/joril/opt/wxGlade-0.7.0-dev/clipboard.py", line 33
Function "_widget2repr(self=<clipboard._WidgetDataObject; proxy of
<Swig Object of type 'wxCustomDataObject *' at 0x4040870> >, *args=(0,
0, 0, u'<object class="wxStaticText" name="lbl_gest_lavor
azione" base="EditStaticText">\n <attribute>1</attribute>\n
<label>Attivit\xe0</label>\n</object>\n'))"
Source code context:
*args contains option, flag, border, xml_str.
"""
assert len(args) == 4
-> return ":".join([str(elem) for elem in args])
def GetWidgetData(self):
"""\
Local variables:
-> self (<class 'clipboard._WidgetDataObject'>):
<clipboard._WidgetDataObject; proxy of <Swig Object of type
'wxCustomDataObject *' at 0x4040870> >
-> args (<type 'tuple'>): (0,
0,
0,
u'<object class="wxStaticText" name="lbl_gest_lavorazione"
base="EditStaticText">\n <attribute>1</attribute>\n
<label>Attivit\xe0</label>\n</object>\n')
-> elem (<type 'unicode'>): u'<object class="wxStaticText"
name="lbl_gest_lavorazione" base="EditStaticText">\n
<attribute>1</attribute>\n <label>Attivit\xe0</label>\n</object>\n'
I patched clipboard.py like this:
return ":".join([unicode(elem).encode("utf-8") for elem in args])
but I don't know if there's a better way.
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet