Re: CustomTreeCtrl bug with multi-byte Unicode text
Robin Dunn <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wednesday, April 26, 2017 at 9:43:20 AM UTC-7, Robin Dunn wrote:
>
>
> On Saturday, April 22, 2017 at 8:30:14 PM UTC-7, obdev wrote:
>>
>> UnicodeDecodeError: 'utf8' codec can't decode byte 0xd8 in position 53:
>> invalid continuation byte
>>
>>
>>
>
> I wasn't able to reproduce your error but I would try converting your
> strings to unicode objects before adding them to the tree.
>
> if not isinstance(t, unicode):
> t = t.decode('utf-8')
> child = self.AppendItem(self.root, t, ct_type=1)
>
That's for Python 2.7. In Python 3 they will already be unicode.
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.