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 4, 2019
1 parent 2d1df35 commit 0295468
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion contrib/pylightning/lightning/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 @@ -1700,7 +1700,6 @@ def test_signmessage(node_factory):
assert checknokey['verified']


@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 0295468

Please sign in to comment.