HomePhabricator

test: Explicitly set encoding to utf8 when opening text files

Description

test: Explicitly set encoding to utf8 when opening text files

These are text files but their encoding does not depend on the locale.
Not all of them require utf8 but it is better to fix it at something
to remove potential unpredictability.

This is necessary on FreeBSD where no locale is set by default,
and apparently Python defaults not only the terminal encoding to the locale
but that of every text file. So without LOCALE environment it defaults text
file encoding to ASCII. This causes problems with e.g. bitcoin.conf.

Luckily the locale doesn't affect the default encoding for str.encode() and
bytes.decode() on Python 3, so this is the only change necessary.

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Sep 29 2016, 15:34
deadalnixPushed on May 14 2017, 22:04
Parents
rABCf560d9564f74: Merge #8826: Do not include env_win.cc on non-Windows systems
Branches
Unknown
Tags
Unknown

Event Timeline

Wladimir J. van der Laan <laanwj@gmail.com> committed rABC30930e847e24: test: Explicitly set encoding to utf8 when opening text files (authored by Wladimir J. van der Laan <laanwj@gmail.com>).Sep 29 2016, 15:50