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
This commit is contained in:
P. Christeas
2010-11-23 17:19:30 +02:00
parent 1a0a2535a2
commit 6e893f1e9e
+3 -2
View File
@@ -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),