[reportlab-users] Problems with unicode in labels of pie charts

Robin Becker robin at reportlab.com
Fri Sep 28 07:14:35 EDT 2007


Sebastian Ware wrote:

> Hi!

>

> I am new to Reportlab and it is very impressive. I have however come

> across a problem with unicode in pie charts.

>

> Labels with non-ascii charcters print fine in a bar chart, but not in a

> pie chart. Reportlab simply refuses to print the label containing these

> non-ascii characters (Swedish åäö or french é).

>

> Any ideas on how to solve this problem?

>

> Mvh Sebastian

......

Are you encoding the labels in utf-8? To test try setting one of the labels to

'\xc3\xa5\xc3\xa4\xc3\xb6' which seems to give the right output.

If you wish to type in latin1 and pass to the label the correct function is

def latin1_to_utf8(s):
return s.decode('latin1').encode('utf-8')
--
Robin Becker


More information about the reportlab-users mailing list