Dinnerbone / mcstatus

A Python class for checking the status of an enabled Minecraft server
http://dinnerbone.com/minecraft/tools/status/
1.11k stars 146 forks source link

If the server name is Korean, the server name cannot be printed out in Korean. #99

Closed minsuho closed 3 years ago

minsuho commented 3 years ago

image

kevinkjt2000 commented 3 years ago

server.properties is parsed as ISO-8859-1 https://bugs.mojang.com/browse/MC-2215 My guess is that Korean characters cannot directly encode to ISO-8859-1 need to be escaped in server.properties in some way. mcstatus is already decoding responses in ISO-8859-1: https://github.com/Dinnerbone/mcstatus/blob/c2fb996528c64d6e84ea72e6f438e8ef02ac6a64/mcstatus/protocol/connection.py#L74

I tested with motd set to 여보세요, and found:

>>> query.motd == u"여보세요".encode("utf-8").decode("iso-8859-1")
True
>>> query.motd
ì¬ë³´ì¸ì
>>> query.motd.encode("iso-8859-1").decode("utf-8") == u"여보세요"
True
>>> query.motd.encode("iso-8859-1").decode("utf-8")
여보세요

I also found that after starting the minecraft server, server.properties had this for the motd:

motd=\u00EC\u0097\u00AC\u00EB\u00B3\u00B4\u00EC\u0084\u00B8\u00EC\u009A\u0094
kevinkjt2000 commented 3 years ago

As an FYI, 여보세요 (a.k.a. \u00EC\u0097\u00AC\u00EB\u00B3\u00B4\u00EC\u0084\u00B8\u00EC\u009A\u0094) shows up incorrectly in the client too: image

Which is what https://bugs.mojang.com/browse/MC-2215 is open for.

kevinkjt2000 commented 3 years ago

Please comment if query.motd.encode("iso-8859-1").decode("utf-8") works for you, and I'll close this. There's not much else anyone could do unless Mojang fixed the character encodings on their end.

minsuho commented 3 years ago

Thank you. It's settled.