From 6021fd883f78f41dea6c2a07fb970e230225b995 Mon Sep 17 00:00:00 2001 From: "Abdelouahab (abla)" Date: Thu, 16 Nov 2023 10:53:10 +0100 Subject: [PATCH] [FIX] base: report html must be parsed as unicode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To reproduce ============ having a special character in url like `à` (it's possible) try to print an invoice, a weird character is printed next to currency symbol Problem ======= Apparently the method responsible of converting from string to html analyzes the few first characters to determine the encoding, so having the base url in the beginning with its special character leads to wrong encoding. Solution ======== convert using html parser with unicode encoding opw-3415418 closes odoo/odoo#143462 X-original-commit: b1cf2a209230b4ace817ff51ab5f55f19b586b11 Signed-off-by: Rémy Voet (ryv) Signed-off-by: Abdelouahab Laaroussi (abla) --- odoo/addons/base/models/ir_actions_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index a9016156545..5f32b39877d 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -346,7 +346,7 @@ class IrActionsReport(models.Model): return {} base_url = IrConfig.get_param('report.url') or layout.get_base_url() - root = lxml.html.fromstring(html) + root = lxml.html.fromstring(html, parser=lxml.html.HTMLParser(encoding='utf-8')) match_klass = "//div[contains(concat(' ', normalize-space(@class), ' '), ' {} ')]" header_node = etree.Element('div', id='minimal_layout_report_headers')