You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I start docxtpl from the command line as module and my json file contains UTF-8 encoded special characters, they seem to be wrong encoded in the resulting docx.
To reproduce it, simply add a character like "ä" in the
tests/templates/module_execute.json file and run the module_execute.py in the tests directory.
I see the wrong character at your DOCX file but I can't reproduce it. (Python 3.10.13, docxtpl 0.16.5)
Moreover I add to JSON chinese characters and some arabic characters. For me all characters are OK.
Well on another machine (Python 3.11.2, docxtpl 0.16.6) I can reproduce the problem.
Nor umlauts letter nor chinese characters nor arabic characters doesn't rendered correctly.
Same issue for me - any Unicode symbols rendered incorrectly when running via module. I think the issue is in get_json_data - it should open the json file with utf-8 encoding.
Activity
elapouya commentedon Nov 13, 2023
Cannot reproduce the problem by adding "ä", please provide your json file.
netaddict commentedon Nov 16, 2023
Tested it again on MacOS, seems ok here. Another Test on Windows (x64 Python 3.10.9) failed somewhat (see files attached).
module_execute.json
module_execute.docx
SergeyZaykov commentedon Nov 20, 2023
I see the wrong character at your DOCX file but I can't reproduce it. (Python 3.10.13, docxtpl 0.16.5)
Moreover I add to JSON chinese characters and some arabic characters. For me all characters are OK.
module_execute.json
module_execute.docx
Which version of docxtpl are you using?
SergeyZaykov commentedon Nov 20, 2023
Well on another machine (Python 3.11.2, docxtpl 0.16.6) I can reproduce the problem.
Nor umlauts letter nor chinese characters nor arabic characters doesn't rendered correctly.
elapouya commentedon Jan 3, 2024
Still cannot reproduce the problem : @SergeyZaykov : please provide .docx template and .json file.
SergeyZaykov commentedon Jan 9, 2024
@elapouya
Here are the problematic template and the JSON data.:
module_execute.json
module_execute_tpl.docx
Python 3.11.2
docxtpl 0.16.6
dmitriadov commentedon Aug 27, 2025
Same issue for me - any Unicode symbols rendered incorrectly when running via module. I think the issue is in get_json_data - it should open the json file with utf-8 encoding.
Read json data and write xml as UTF-8, whatever the locale
cvas22 commentedon Nov 22, 2026
@netaddict @SergeyZaykov @dmitriadov fyi, this is fixed in Docform (the maintained fork at https://github.com/cvas22/docform,
docformon PyPI) with #655 by @davidpavlovschi, merged in cvas22/docform#173. It'll be in the next release.