From 1379435c8b62f29421edaea801f043157b2b3371 Mon Sep 17 00:00:00 2001 From: Jarret Dyrbye Date: Mon, 2 Sep 2019 15:29:56 -0600 Subject: [PATCH] pylightning - allow unicode symbols in the description to be passed as-is to the daemon addresses issue #2753. Formatting the JSON with the default parameters will escape the unicode symbols in a way that c-lightning won't allow, leading to an exception. Changelog-Fixed: `pylightning` now handles unicode characters in JSON-RPC requests and responses correctly. --- contrib/pyln-client/pyln/client/lightning.py | 2 +- tests/test_misc.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/pyln-client/pyln/client/lightning.py b/contrib/pyln-client/pyln/client/lightning.py index 4912e18b6aaf..99ec9e859125 100644 --- a/contrib/pyln-client/pyln/client/lightning.py +++ b/contrib/pyln-client/pyln/client/lightning.py @@ -172,7 +172,7 @@ def __init__(self, socket_path, executor=None, logger=logging, encoder_cls=json. self.next_id = 0 def _writeobj(self, sock, obj): - s = json.dumps(obj, cls=self.encoder_cls) + s = json.dumps(obj, ensure_ascii=False, cls=self.encoder_cls) sock.sendall(bytearray(s, 'UTF-8')) def _readobj(self, sock, buff=b''): diff --git a/tests/test_misc.py b/tests/test_misc.py index 5002c15fd931..ca19ca3c44a4 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -2000,7 +2000,6 @@ def test_new_node_is_mainnet(node_factory): assert os.path.isfile(os.path.join(basedir, "lightningd-bitcoin.pid")) -@pytest.mark.xfail(strict=True) def test_unicode_rpc(node_factory): node = node_factory.get_node() desc = "Some candy 🍬 and a nice glass of milk 🥛."