mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
force stdout/stderr encoding to utf8
As a GUI app, Anki only uses these for debugging info, and we've been bitten numerous times in the past by bugs caused by printing Unicode when the console only supported ASCII. An ens var might have been a better approach, but Pyinstaller does not support defining them before Python is initialized from what I can tell. Latest issue: https://forums.ankiweb.net/t/crashing-anki-version-2-1-29-bbff62bf/1650
This commit is contained in:
parent
07594bc375
commit
a8139ebb40
1 changed files with 5 additions and 0 deletions
|
@ -24,6 +24,11 @@ from aqt.utils import locale_dir
|
|||
|
||||
assert anki.buildinfo.buildhash == aqt.buildinfo.buildhash
|
||||
|
||||
# we want to be able to print unicode debug info to console without
|
||||
# fear of a traceback on systems with the console set to ASCII
|
||||
sys.stdout.reconfigure(encoding="utf-8") # type: ignore
|
||||
sys.stderr.reconfigure(encoding="utf-8") # type: ignore
|
||||
|
||||
appVersion = _version
|
||||
appWebsite = "https://apps.ankiweb.net/"
|
||||
appChanges = "https://apps.ankiweb.net/docs/changes.html"
|
||||
|
|
Loading…
Reference in a new issue