diff --git a/addons/base_report_designer/base_report_designer.py b/addons/base_report_designer/base_report_designer.py index 2371bc8e216..547171b6bff 100644 --- a/addons/base_report_designer/base_report_designer.py +++ b/addons/base_report_designer/base_report_designer.py @@ -25,7 +25,7 @@ from StringIO import StringIO import base64 import pooler import addons -import sys + class report_xml(osv.osv): _inherit = 'ir.actions.report.xml' @@ -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()