[FIX] base: report html must be parsed as unicode

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) <ryv@odoo.com>
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2023-11-24 11:17:03 +00:00
parent 912a918175
commit 6021fd883f
+1 -1
View File
@@ -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')