From 7659b8d70aaf591e04eaed118000fdf720fc0b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Sat, 29 Jul 2017 17:24:09 +0200 Subject: [PATCH] Fix CodeShare integration on Py3k < 3.6 We should decode the REST API response and not rely on json.loads() accepting `bytes`, which it does starting with 3.6. Thanks to @sdroege for reporting! --- src/frida/repl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frida/repl.py b/src/frida/repl.py index e1f88b7..93cd723 100644 --- a/src/frida/repl.py +++ b/src/frida/repl.py @@ -486,7 +486,10 @@ rpc.exports.evaluate = function (expression) { request = build_opener() request.addheaders = [('User-Agent', 'Frida v{} | {}'.format(frida.__version__, platform.platform()))] response = request.open(project_url) - response_content = response.read() + charset = response.headers.get_content_charset() + if charset is None: + charset = 'utf-8' + response_content = response.read().decode(charset) response_json = json.loads(response_content) except Exception as e: self._print("Got an unhandled exception while trying to retrieve {} - {}".format(uri, e))