[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

/usr/lib/python2.3/site-packages/eric/Debugger/VariablesViewer.py

in line 262:

 try:
  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

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




More information about the PyQt mailing list