[reportlab-users] Setting default encoding

Andy Robinson andy at reportlab.com
Wed Sep 13 12:02:13 EDT 2006


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.

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

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.
Some notes on this are here:

    http://www.reportlab.org/whatsnew_2_0.html

Best Regards,


Andy Robinson








More information about the reportlab-users mailing list