mcpi
mcpi copied to clipboard
Suggestion for postToChat() function to send garbled messages in the game
I noticed that the bottom layer of the postToChat() function is sent to the game in utf-8 encoding, but the chat message box in minecraft seems to use gbk encoding, which causes sending non-ascii characters to become in-game Garbled, I suggest adding a parameter to allow the postToChat() function to choose the encoding of the message to avoid problems.
I am not sure about Java Edition, but Pi edition uses CP437.
I tested on minecraft Java Edition 1.11.2 server, using minecraftPythonAPI plugin
I changed the encoding in the _misc_to_bytes function to gbk, so that I can use postToChat() to send Chinese without garbled characters