aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/multi_rpc.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-09-29 15:34:44 +0000
committerMarcoFalke <falke.marco@gmail.com>2016-10-03 11:54:29 +0200
commitcbc3fe59c4d92784411f5d40207ddde61fa5a892 (patch)
tree800641ca3653f66192283e5f4f3f5800a6c27051 /qa/rpc-tests/multi_rpc.py
parent0bee740845b9c7599e041b0be7111c8debaff63b (diff)
downloadbitcoin-cbc3fe59c4d92784411f5d40207ddde61fa5a892.tar.xz
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. Github-Pull: #8840 Rebased-From: 30930e847e2483c7c8163cc581b392bc288250e9
Diffstat (limited to 'qa/rpc-tests/multi_rpc.py')
-rwxr-xr-xqa/rpc-tests/multi_rpc.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/qa/rpc-tests/multi_rpc.py b/qa/rpc-tests/multi_rpc.py
index 24373b257d..cdeb94caa0 100755
--- a/qa/rpc-tests/multi_rpc.py
+++ b/qa/rpc-tests/multi_rpc.py
@@ -26,7 +26,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
#Append rpcauth to bitcoin.conf before initialization
rpcauth = "rpcauth=rt:93648e835a54c573682c2eb19f882535$7681e9c5b74bdd85e78166031d2058e1069b3ed7ed967c93fc63abba06f31144"
rpcauth2 = "rpcauth=rt2:f8607b1a88861fac29dfccf9b52ff9f$ff36a0c23c8c62b4846112e50fa888416e94c17bfd4c42f88fd8f55ec6a3137e"
- with open(os.path.join(self.options.tmpdir+"/node0", "bitcoin.conf"), 'a') as f:
+ with open(os.path.join(self.options.tmpdir+"/node0", "bitcoin.conf"), 'a', encoding='utf8') as f:
f.write(rpcauth+"\n")
f.write(rpcauth2+"\n")