djhtml icon indicating copy to clipboard operation
djhtml copied to clipboard

Djhtml fails to complete due to old default encoding on windows

Open jeriox opened this issue 6 months ago • 2 comments

When running djhtml on Windows 11 for my project, it fails with Error: 'charmap' codec can't decode byte 0x8f in position 622: character maps to <undefined>. According to various sources (e.g. https://stackoverflow.com/a/68650013) this is due to Windows using an outdated encoding (windows-1252) by default if no encoding is specified when opening the file. This encoding fails to read utf-8 characters. Adding encoding="utf-8" to the open() call in https://github.com/rtts/djhtml/blob/main/djhtml/main.py#L53 solves the problem for me.

jeriox avatar Jul 30 '24 12:07 jeriox