[PyKDE] eric3 VariableViewer crashes on non-utf8 strings

Krystof Zacek krystof.zacek at i.cz
Wed Oct 13 14:07:41 BST 2004

This is caused by file


in line 262:

  slist = unicode(list[i], 'utf-8')
 except TypeError:
  slist = str(list[i])

If the variable string contains a character which is not convertable from utf8 
(like e.g. czech nationale characters encoded in  iso-8859-2), then the 
unicode() raises exception UnicodeDecodeError, which is not trapped by the 
eric code.

I dare to suggest the following change:

 import locale

  slist = unicode(list[i], locale.getlocale()[1])
 except TypeError:
  slist = str(list[i])

More information about the PyQt mailing list