mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix encoding
This commit is contained in:
@@ -93,7 +93,8 @@ def dump(data: object) -> bytes:
|
||||
Returns:
|
||||
The encoded bytes.
|
||||
"""
|
||||
return b"s%i:%s" % (len(datum), datum.encode("utf-8"))
|
||||
encoded_data = datum.encode("utf-8")
|
||||
return b"s%i:%s" % (len(encoded_data), encoded_data)
|
||||
|
||||
def encode_list(datum: list) -> bytes:
|
||||
"""
|
||||
|
||||
@@ -15,6 +15,7 @@ from textual._binary_encode import DecodeError, dump, load
|
||||
1,
|
||||
100,
|
||||
"",
|
||||
"💩",
|
||||
"Hello",
|
||||
b"World",
|
||||
b"",
|
||||
@@ -22,10 +23,18 @@ from textual._binary_encode import DecodeError, dump, load
|
||||
(),
|
||||
[None],
|
||||
[1, 2, 3],
|
||||
(0, "foo"),
|
||||
(1, "foo"),
|
||||
(0, ""),
|
||||
("", "💩", "💩💩"),
|
||||
(""),
|
||||
["hello", "world"],
|
||||
["hello", b"world"],
|
||||
("hello", "world"),
|
||||
("hello", b"world"),
|
||||
("foo", "bar", "baz"),
|
||||
("foo " * 1000, "bar " * 100, "baz " * 500),
|
||||
(1, "foo", "bar", "baz"),
|
||||
{},
|
||||
{"foo": "bar"},
|
||||
{"foo": "bar", b"egg": b"baz"},
|
||||
|
||||
Reference in New Issue
Block a user