[reportlab-users] PDFInfo.digest()

Juha Ruotsalainen kontza at gmail.com
Fri Feb 2 06:57:17 EST 2007


Hi there,

My Python-code sets PDF document's Author, Title, and Subject fields.
Some of those fields have unicode characters in them. If I try to save
the document, PDFInfo class' function digest stock implementation
raises UnicodeEncodeError on md5object.update(str(x)). Being a hacker
at heart, I changed that particular line into md5object.update(
x.encode('cp1252') ). No excepstions raised, the document gets saved,
and both WinXP & AcroRead display the metadata correctly (i.e. the
unicode characters).

I'm curiours to know what would be the 'correct' approach? Reportlab gurus?

Cheers,
--
jussi


More information about the reportlab-users mailing list