Encode/decode as utf8.

I believe this fixed a bug that was occurring some time back.
This commit is contained in:
Simon Howard 2016-01-21 05:08:52 +00:00
parent 47da0dbd89
commit 87b5ff04ba

View file

@ -78,7 +78,7 @@ def read_string(packet):
result, = struct.unpack("%ss" % strlen, packet[0:strlen])
return packet[strlen + 1:], result
return packet[strlen + 1:], result.decode('utf8')
class Server:
""" A server that has registered itself. """
@ -292,7 +292,7 @@ class MasterServer:
def metadata_string(server):
metadata = server.metadata.copy()
metadata["age"] = server.age()
return simplejson.dumps(metadata)
return simplejson.dumps(metadata).encode('utf8')
# Generate a list of strings containing JSON-encoded metadata
# about servers. Only include verified servers.