From 0001c0ad8ee08c1746225ffbf3c85194d02753b0 Mon Sep 17 00:00:00 2001 From: "Sbh (OpenERP)" Date: Thu, 6 Jan 2011 17:26:13 +0530 Subject: [PATCH] [Fix] baser_report_desinger: fix the problem of encodestring lp bug: https://launchpad.net/bugs/697066 fixed bzr revid: sbh@tinyerp.com-20110106115613-dh4rcqxvqb6031b4 --- addons/base_report_designer/base_report_designer.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/base_report_designer/base_report_designer.py b/addons/base_report_designer/base_report_designer.py index 2371bc8e216..5695f9004d7 100644 --- a/addons/base_report_designer/base_report_designer.py +++ b/addons/base_report_designer/base_report_designer.py @@ -60,12 +60,15 @@ class report_xml(osv.osv): def report_get(self, cr, uid, report_id, context=None): report = self.browse(cr, uid, report_id, context=context) - reload(sys) - sys.setdefaultencoding( "latin-1" ) + try: + sxw_data=(report.report_sxw_content).encode("iso-8859-1", "replace") + rml_data= (report.report_rml_content).encode("iso-8859-1", "replace") + except : + pass return { 'file_type' : report.report_type, - 'report_sxw_content': report.report_sxw_content and base64.encodestring(report.report_sxw_content) or False, - 'report_rml_content': report.report_rml_content and base64.encodestring(report.report_rml_content) or False + 'report_sxw_content': report.report_sxw_content and base64.encodestring(sxw_data) or False, + 'report_rml_content': report.report_rml_content and base64.encodestring(rml_data) or False } report_xml()