Hi all I'm trying to output a PDF generated with Reportlab within a WebKit servlet. The PDF data seems to be in WinAnsiEncoding (CP1252).
If I just output the data with self.write(pdf), I get this error:
File "/opt/Webware/WebKit/ASStreamOut.py", line 84, in flush
self._buffer += ''.join(self._chunks)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 11:
ordinal not in range(128)
I don't know why it wants to decode it as ASCII... so let's try to
decode it by myself and send it as Unicode:
self.write(unicode(pdf, "CP1252"))
Which leads me to a problem within the HTTPContent class:
File "/opt/Webware/WebKit/HTTPContent.py", line 176, in write
self._response.write(str(arg))
UnicodeEncodeError: 'ascii' codec can't encode characters in position
11-14: ordinal not in range(128)
I can workaround this by using UTF-8 in HTTPContent.write() (which is
what I actually want to do for the normal HTML content anyway):
self._response.write(unicode(arg).encode(self._encoding))
But that doesn't help, still the same problem in ASStreamOut:
File "/opt/Webware/WebKit/ASStreamOut.py", line 84, in flush
self._buffer += ''.join(self._chunks)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 11:
ordinal not in range(128)
I really can't make it -- stuck in the encoding hell. Can somebody help me?
I just want to output that PDF data :-/
Regards,
Mathis
--
DreamLab Technologies AG
Monbijoustrasse 36
3011 Bern
Switzerland
Tel: +41 31 398 66 66
Fax: +41 31 398 66 69
PGP Key ID: 2462240B
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Webware-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/webware-devel
