Fiddle with msgpack bytes vs unicode

This commit is contained in:
Matthew Honnibal 2017-06-01 10:48:43 -05:00
parent 1bebc6392c
commit 1d18cedae8
1 changed files with 2 additions and 2 deletions

View File

@ -423,11 +423,11 @@ def to_bytes(getters, exclude):
for key, getter in getters.items():
if key not in exclude:
serialized[key] = getter()
return msgpack.dumps(serialized)
return msgpack.dumps(serialized, use_bin_type=True, encoding='utf8')
def from_bytes(bytes_data, setters, exclude):
msg = msgpack.loads(bytes_data)
msg = msgpack.loads(bytes_data, encoding='utf8')
for key, setter in setters.items():
if key not in exclude:
setter(msg[key])