From 6e893f1e9e607b3fcf392ae9cbbb4f7c696d4bd3 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 23 Nov 2010 17:19:30 +0200 Subject: [PATCH] rml2pdf: use ustr() instead of unicode() When strings are 8-bit utf8-encoded, unicode will break with the usual: UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position .. message. ustr() will have better luck in those cases. Conflicts: bin/report/render/rml2pdf/utils.py bzr revid: p_christ@hol.gr-20101123151930-8r9q9gg7r902i2nv --- bin/report/render/rml2pdf/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py index e607aabeb20..6f8616da96d 100644 --- a/bin/report/render/rml2pdf/utils.py +++ b/bin/report/render/rml2pdf/utils.py @@ -45,6 +45,7 @@ import reportlab import tools from tools.safe_eval import safe_eval as eval +from tools import ustr _regex = re.compile('\[\[(.+?)\]\]') @@ -131,11 +132,11 @@ def _process_text(self, txt): if isinstance(txt, basestring): result += str2xml(txt) elif (txt is not None) and (txt is not False): - result += unicode(txt) + result += ustr(txt) return result def text_get(node): - return ''.join([unicode(n.text) for n in node]) + return ''.join([ustr(n.text) for n in node]) units = [ (re.compile('^(-?[0-9\.]+)\s*in$'), reportlab.lib.units.inch),