Hi.

I set the Encoding of my reportwriter, but I don't think it sends this
encoding to reportlab (at least not in all cases). Several of the
reportlab functions has an encoding parameter, and this is default to
"utf8".
Here stringWidth is called (does not accept encoding), this in turn
calls _py_stringWidth from pdfmetrics.py, and this always defaults to
'utf8'.

I can fix this by changing 'utf8' to 'latin1' everywhere, but I really
don't feel like it. Does anyone have a solution for this?



Traceback (most recent call last):
  File
"c:\python24\lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\eventMixin.p
y", line 97, in raiseEvent
    bindingFunction(event)
  File "c:\Documents and Settings\simen\My
Documents\Projects\prosjektoversikt_ny\projectreports.py", line 296, in
onShowReportBtn
    self.project_reports.run_reports(project_info, reports)
  File "c:\Documents and Settings\simen\My
Documents\Projects\prosjektoversikt_ny\projectreports.py", line 173, in
run_reports
    report_writer.write(False)
  File
"c:\python24\lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\reportWriter
.py", line 1374, in write
    y = printBand("detail", y)
  File
"c:\python24\lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\reportWriter
.py", line 1301, in printBand
    self.draw(obj, (x1, y1))
  File
"c:\python24\lib\site-packages\Dabo-0.7a-py2.4.egg\dabo\lib\reportWriter
.py", line 894, in draw
    func(posx, 0, s)
  File "C:\Python24\Lib\site-packages\reportlab\pdfgen\canvas.py", line
1179, in drawCentredString
    width = self.stringWidth(text, self._fontname, self._fontsize)
  File "C:\Python24\Lib\site-packages\reportlab\pdfgen\canvas.py", line
1283, in stringWidth
    return pdfmetrics.stringWidth(text, fontName, fontSize)
  File "C:\Python24\Lib\site-packages\reportlab\pdfbase\pdfmetrics.py",
line 709, in _py_stringWidth
    return getFont(fontName).stringWidth(text, fontSize,
encoding=encoding)
  File "C:\Python24\Lib\site-packages\reportlab\pdfbase\pdfmetrics.py",
line 401, in _py_stringWidth
    if not isinstance(text,unicode): text = text.decode(encoding)
  File "C:\Python24\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1-5:
unsupported Unicode code range


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to