[reportlab-users] Using TTFs with non-ASCII characters

Dinu Gherman reportlab-users@reportlab.com
Wed, 03 Jul 2002 11:34:32 +0200 (CEST)


I wrote:

> BTW, what is the canonical way to make non-ASCII characters 
> appear as expected in strings "automatically"? I've tried
> using something like this:
> 
>   c.drawString(100, y, u"äöüÄÖÜßéè")
> 
> Is there another way to do it?

Well, the "usual" trick works: putting it all as escape
sequence, like this:

  c.drawString(100, y,
'\xc3\xb6\xc3\xa4\xc3\xbc\xc3\x96\xc3\x84\xc3\x9c\xc3\x9f\xc3\xa9\xc3\xa8' + '-'
+ (n))

But shouldn't there be a less ugly and more readable way,
too?

Dinu