Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15][qweb report pdf] utf-8 encoding problem #80184

Open
thartmann15 opened this issue Nov 22, 2021 · 0 comments
Open

[15][qweb report pdf] utf-8 encoding problem #80184

thartmann15 opened this issue Nov 22, 2021 · 0 comments

Comments

@thartmann15
Copy link

thartmann15 commented Nov 22, 2021

Impacted versions: odoo 15 on ubuntu 20.04 with wkhtmltopdf 0.12.6 (with patched qt)

Steps to reproduce: Create a PDF using qweb report which has umlauts or some other non-ASCII characters.

Current behavior: The umlauts are not correctly displayed in the PDF.

problem: PDFs created using qweb reports don't display umlauts (or non-ASCII utf-8 characters) correctly.

the underlying issue: the PDFs are created by running wkhtmltopdf on some temporary html files.
in odoo 14, the umlaut 'ü' was encoded in the temporary body html as ' & # 252 ; ' (spaces inserted in order to display it on github).
in odoo 15, the umlaut 'ü' is used as it is.

there are two possible solutions:

(A) One can explicitly specify the encoding as argument to wkhtmltopdf. add
command_args.extend(['--encoding', 'utf-8'])
to _build_wkhtmltopdf_args(...) in ir_actions_report.py

(B) One can force lxml to output '& # 252 ;' . To this end, use
'body': Markup(lxml.html.tostring(node, encoding='ASCII')).decode('utf-8'),
and
body = ''.join(lxml.html.tostring(c, encoding='ASCII').decode('utf-8') for c in body_parent.getchildren())
in _prepare_html(...) in ir_actions_report.py

Could you please adopt one of the two solutions ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant