[reportlab-users] Unicode support in platypus.para Module?

Robin Becker robin at reportlab.com
Thu Jun 29 06:23:37 EDT 2006


Dirk Holtwick wrote:
> Hi,
> 
> here once again my yet unanswered question. Is it possible, that the
> para.py module has no Unicode support? Will it be added in future?
> 
> Bye,
> Yours Dirk
> 
> Dirk Holtwick schrieb:
>> Hello,
>>
>> at first it is great that now Unicode is widely supported in the
>> Reportlab Toolkit. Thanks.
>>
>> Now to my problem: I use the platypus.para module for generating pages.
>> If I now use an opcode that is coded in UTF-8 or Unicode I get
>> exceptions. The easiest way to reproduce this, is to encode a string in
>> the 'test_program' in the module itself.
>>
>> To fix an error I got with my program I changed the method "runOpCodes"
>> in line 703 of the recent version in the repository to:
>>
>>                     opcode = opcode.encode("latin1","ignore")
>>                     text = escape(opcode)
>>
>> Then it works fine for Postscript and TTF fonts. Any idea?
>>
>> Bye, Dirk
>>

.......
Dirk, I'm not an expert on the para code, but the problem here is really about 
the fonts. For the other kind of paragraph we have quite a complex mechanism for 
converting unicode/utf8 into the pdf text that's required. At the very least we 
need to know what font is being used at the text issuing point. I can get that 
using the fontName variable (I believe) so then the same kind of string 
processing can be used to get the text correctly encoded.

I don't have time right now, but prod me at the weekend with a breaking example 
eg 'hello world' with some wrong behaviour and I'll have a go at fixing this.
-- 
Robin Becker


More information about the reportlab-users mailing list