diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-09-29 15:34:44 +0000 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-09-29 17:50:05 +0200 |
commit | 30930e847e2483c7c8163cc581b392bc288250e9 (patch) | |
tree | 2231659b4b0b00ba5e0e347d549ab97d5f254b1e /qa/rpc-tests/wallet-dump.py | |
parent | f560d9564f74ae8f4b449121b22703b23db3d010 (diff) |
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.
Diffstat (limited to 'qa/rpc-tests/wallet-dump.py')
-rwxr-xr-x | qa/rpc-tests/wallet-dump.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qa/rpc-tests/wallet-dump.py b/qa/rpc-tests/wallet-dump.py index 6028d2c20b..a37096a40c 100755 --- a/qa/rpc-tests/wallet-dump.py +++ b/qa/rpc-tests/wallet-dump.py @@ -12,7 +12,7 @@ def read_dump(file_name, addrs, hd_master_addr_old): Read the given dump, count the addrs that match, count change and reserve. Also check that the old hd_master is inactive """ - with open(file_name) as inputfile: + with open(file_name, encoding='utf8') as inputfile: found_addr = 0 found_addr_chg = 0 found_addr_rsv = 0 |