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
{{ message }}
Repository navigation
cz changelog --export-template raises UnicodeDecodeError on a non-ASCII template where the locale is not UTF-8 #2136
cz changelog --export-template reads and writes the template in the locale's encoding. Jinja reads the same template as UTF-8, so a template that renders can fail to export, for example one with Korean text where the locale is EUC-KR.
Steps to reproduce
On Linux with the ko_KR.EUC-KR locale generated, in an empty directory:
UnicodeDecodeError: 'euc_kr' codec can't decode byte 0x80 in position 5: illegal multibyte sequence
Desired behavior
out.md has the same bytes as my.md.j2, as it does under C.UTF-8.
Environment
Commitizen Version: 4.20.1 (master, 4c4b791)
Python Version: 3.14.4 (main, Aug 20 2026, 10:41:58) [GCC 15.2.0]
Operating System: Linux
I have not run cz itself on Windows. On Windows 11 with cp949, Path.read_text() of the same kind of text raises UnicodeDecodeError.
#1854 changed these two lines among others and was closed without a reproducing test. #2119 fixed cz commit --edit and cz init and did not touch them. I would like to send a PR with only these two lines and a test that fails without them, if you agree.
This was found and written with the help of Claude Code.
@stella-h-choi are you still planning to send the PR for this? If you are, go ahead and I'll leave it to you. If not, I have the two-line fix and a test ready (it simulates a non-UTF-8 locale and covers the read and the write) and can open it.
Yes, I'm still planning to open the PR — thanks for checking in, and for having the fix ready.
I'm putting together the two-line change in commitizen/commands/changelog.py (_export_template: read and write as UTF-8) together with a test that simulates a non-UTF-8 locale and covers both the read and the write, and I'll open it shortly. Sorry it took me a while to get back to you; I'll update here if anything turns out to block it.
Activity
jseiden12 commentedon Dec 4, 2026
@stella-h-choi are you still planning to send the PR for this? If you are, go ahead and I'll leave it to you. If not, I have the two-line fix and a test ready (it simulates a non-UTF-8 locale and covers the read and the write) and can open it.
stella-h-choi commentedon Dec 5, 2026
Yes, I'm still planning to open the PR — thanks for checking in, and for having the fix ready.
I'm putting together the two-line change in
commitizen/commands/changelog.py(_export_template: read and write as UTF-8) together with a test that simulates a non-UTF-8 locale and covers both the read and the write, and I'll open it shortly. Sorry it took me a while to get back to you; I'll update here if anything turns out to block it.