Skip to content

Commit

Permalink
pylightning - allow unicode symbols in the description to be passed a…
Browse files Browse the repository at this point in the history
…s-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.
  • Loading branch information
jarret authored and cdecker committed Nov 26, 2019
1 parent ba9e35a commit 1379435
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion contrib/pyln-client/pyln/client/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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''):
Expand Down
1 change: 0 additions & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 🥛."
Expand Down

0 comments on commit 1379435

Please sign in to comment.