[PyKDE] Converting font names to python strings

Jeremy Sanders jeremy at jeremysanders.net
Tue Apr 19 14:34:59 BST 2005


One of my users is having problems with my code. It looks like it might be 
to do with converting QStrings to Python strings if they are unicode:

The code is:

         db = qt.QFontDatabase()

         # build a dict up with the list of families
         families = {}
         for i in db.families():
             families[str(i)] = True

This gives an exception:
UnicodeEncodeError: 'ascii' codec can't encode characters in position
0-6: ordinal not in range(128)

I had assumed this would just work. Am I wrong? Any ideas???

Thanks

Jeremy

-- 
Jeremy Sanders <jeremy at jeremysanders.net>
http://www.jeremysanders.net/                Cambridge, UK
Public Key Server PGP Key ID: E1AAE053




More information about the PyQt mailing list