This repository was archived by the owner on Jan 22, 2026. It is now read-only.
Commit 731faec
committed
Read jinja template with UTF-8 encoding set explicitly
Today we started seeing an UnicodeDecodeError error, coming from the
changed line: 'ascii' codec can't decode byte 0xc3 in position 2980:
ordinal not in range(128). This appeared after submitting the form.
The Path.read_text() function uses the locale's encoding by default.
AFAIK there have been some server configuration changes recently. To
my surprise, after ssh'ing into the server, I discovered that the
encoding returned by locale.getencoding() was ANSI_X3.4-1968. We then
changed the encoding to UTF-8 and bounced the server. When run by a
user (me), the locale.getencoding() now returns UTF-8. Yet, when
executed inside store_data.py, it still returns ANSI_X3.4-1968. See
commit f3c82f4.
This commit changes the from_string() call to explicitly use UTF-8. It
should prevent locale settings from interfering with loading the
template (which contains some umlauts).1 parent f3c82f4 commit 731faec
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
| |||
0 commit comments