mirror of
https://github.com/Dinnerbone/mcstatus.git
synced 2026-04-06 12:01:24 +08:00
Default charset is actually ISO-8859-1, not ascii.
This commit is contained in:
@@ -66,13 +66,13 @@ class Connection:
|
|||||||
self.write(bytearray(value, 'utf8'))
|
self.write(bytearray(value, 'utf8'))
|
||||||
|
|
||||||
def read_ascii(self):
|
def read_ascii(self):
|
||||||
result = ""
|
result = bytearray()
|
||||||
while len(result) == 0 or result[-1] != "\x00":
|
while len(result) == 0 or result[-1] != 0:
|
||||||
result += self.read(1).decode("ascii")
|
result.extend(self.read(1))
|
||||||
return result[:-1]
|
return result[:-1].decode("ISO-8859-1")
|
||||||
|
|
||||||
def write_ascii(self, value):
|
def write_ascii(self, value):
|
||||||
self.write(bytearray(value, 'ascii'))
|
self.write(bytearray(value, 'ISO-8859-1'))
|
||||||
self.write(bytearray.fromhex("00"))
|
self.write(bytearray.fromhex("00"))
|
||||||
|
|
||||||
def read_short(self):
|
def read_short(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user