demo - encode error

Werner F. Bruhin wrote:

If I press enter in the search control in the demo I always get this traceback.

Traceback (most recent call last):
  File "C:\Python25\Doc\wxPython2.8 Docs and Demos\demo\Main.py", line 1631, in
OnSearch
    if SearchDemo(childItem, value):
  File "C:\Python25\Doc\wxPython2.8 Docs and Demos\demo\Main.py", line 848, in S
earchDemo
    if fullText.find(keyword) >= 0:
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 140-142: invalid
data

I changed main.py to print info on exception:
    try:
        if fullText.find(keyword) >= 0:
            return True
    except:
        print 'name: %s' % name
        print 'keyword: %s' % keyword

and problem is in ogl.py but I can't see what is wrong in there.

It's simply that the file is in iso-8859-1 encoding and the ä in the comment is confusing the utf-8 encoding that is being used to convert the text for the find.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!