[reportlab-users] Platypus & unicode

Robin Becker robin at reportlab.com
Wed Nov 14 09:16:57 EST 2007


Wietse Jacobs wrote:

> On 14/11/2007, Andy Robinson wrote:

>> On 14/11/2007, Andrew Smart <smart at smart-knowhow.de> wrote:

>>> Simple question: do I have to use utf-8 "coded" strings as input for

>>> Platypus?

>> Either utf-8 encoded strings or unicode objects (u"Hello World"). Both

>> should work. I'd suggest unicode objects.

>

> I was struggling with the same issue and changed my code to use unicode

> strings. But I think I stumbled onto a bug:

>

> In the file pdfgen/pdfimages.py on line 130 it reads:

>

> if type(image) == StringType:

>

> which causes my code to fail because I was sending in a pathname as a

> unicode object.

>

> (BTW: is this the proper place to report a bug?)

>

> Wietse Jacobs

......
we use mostly utf8 encoded strings precisely because there are problems using
unicode everywhere. Besides being utterly wasteful of storage, unicode adds
nothing to utf8. Using unicode throughout is possible and presumably will be
done. Meanwhile it's not true that you can just use unicode except on the text
paths(ie places which correspond to textual information) where we are attempting
to support it fully. No doubt as python 3 approaches we will make an effort to
eliminate all uses of strings so we can fully utilize our machinery.
--
Robin Becker


More information about the reportlab-users mailing list