Hi,
jo wrote:
Hi,
stc sometimes does not load files containing funny characters. I tried SetCodePage to utf8 but that did not help. It still uses cp1252.
I am using python26 and print wx.version( )
2.8.10.1 (msw-unicode)File "Q:\Editor.py", line 747, in SetValue
self.SetText(value)
What does "value" contain when you get this error? What encoding are you using, i.e. what you get:
import sys
>>> sys.getdefaultencoding()
'utf-8'
import locale
>>> locale.getpreferredencoding()
'cp1252'
File "d:\python26\lib\site-packages\wx-2.8-msw-unicode\wx\stc.py", line 2934, in SetText
return _stc.StyledTextCtrl_SetText(*args, **kwargs)
File "d:\python26\lib\encodings\cp1252.py", line 15, in decode
return codecs.charmap_decode(input,errors,decoding_table)
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 165464: character maps to <undefined>
With some googling I found this thread, it might be helpful.
http://mail.python.org/pipermail/python-list/2009-January/698541.html
Werner