python-docx-template
python-docx-template copied to clipboard
Wrong encoding when runned via module
Hi,
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.
Cannot reproduce the problem by adding "ä", please provide your json file.
Tested it again on MacOS, seems ok here. Another Test on Windows (x64 Python 3.10.9) failed somewhat (see files attached).
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?
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.
Still cannot reproduce the problem : @SergeyZaykov : please provide .docx template and .json file.
@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