[reportlab-users] Setting default encoding

Paul McNett p at ulmcnett.com
Wed Sep 13 16:58:48 EDT 2006


Andy Robinson wrote:
> Paul McNett wrote:
>> Sorry for this, I quickly scanned the docs and didn't find the answer. 
>> To set the default unicode encoding so I don't have to pass it to each 
>> function call explicitly, do I just make the following:
>>
>> from reportlab import rl_config
>> rl_config.default_encoding = "latin-1"
> 
> This is a 'legacy' piece of code to do with how fonts are encoded for 
> output; we didn't delete it as it might have been useful for a few 
> people on older Macs, but it's unrelated to anything you do in calling 
> our APIs.  I should really get rid of it.

Same answer for the functions in reportlab that take an encoding argument?

> In version 2.0 you are supposed to either pass in
> (a) Unicode objects to all APIs, which are unambiguous
> (b) 8-bit strings encoded in utf8

Ok, we can make 2.0 a requirement.


> In short, input is your problem ;-)  We felt there would be less 
> confusion in the long run if we told everyone to deal with it themselves 
> rather than having 'magic' inside our library.

Sounds reasonable. So you never need to encode/decode the unicode object 
we send? If you do need to encode/decode, how do you know the proper 
encoding to use?

> Some notes on this are here:
> 
>    http://www.reportlab.org/whatsnew_2_0.html

Thanks!

-- 
Paul McNett
http://paulmcnett.com
http://dabodev.com



More information about the reportlab-users mailing list