[Image-SIG] ImageFont Unicode Decode error

Donn donn.ingle at gmail.com
Wed Dec 26 15:40:23 CET 2007


Hello,
 Trying to open a ttf file with a non-standard character in it (u'\xe5') 
causes an error, no matter what I pass to encoding:

enc="unic"
enc="unicode"
enc="utf8"
etc.
font = ImageFont.truetype( paf, 64, index=i , encoding=enc )

The error:
  File "/usr/lib/python2.5/site-packages/PIL/ImageFont.py", line 205, in 
truetype
    return FreeTypeFont(filename, size, index, encoding)
  File "/usr/lib/python2.5/site-packages/PIL/ImageFont.py", line 121, in 
__init__
    self.font = _imagingft.getfont(file, size, index, encoding)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 
66: ordinal not in range(128)


Is there something I'm doing wrong, or is this a bug?

\d


More information about the Image-SIG mailing list