PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.95k stars 904 forks source link

Chat API doesn't support Chinese #362

Closed Snownee closed 8 years ago

Snownee commented 8 years ago

In chat.js, 125 lines. Chinese texts are mistakenly filtered.

deathcap commented 8 years ago

Filter is:

lib/plugins/chat.js
4:var LEGAL_CHARS = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»§';
Snownee commented 8 years ago

But Chinese is: [\u4e00-\u9fa5] I'm afraid that is too huge to let this var be assigned : )

rom1504 commented 8 years ago

I'm trying to figure out why was this filter added. It looks like it tries to filter colors with the paragraph character

https://github.com/PrismarineJS/mineflayer/commit/b5246aaf6f05221ff3c39aa6a94fc31da7acb957

https://github.com/PrismarineJS/mineflayer/commit/6606d7b52f49ed580412a4f7a86b7031dc11f9af

https://github.com/PrismarineJS/mineflayer/commit/217d1fd3084134a6b4eafd1aae1a0632a6a3839b : this filter dates back from the beginning of mineflayer in js (it was c++ before that commit) so indeed it might not be relevant anymore.

Someone should try removing the filter altogether and see if that breaks anything

rom1504 commented 8 years ago

fixed by #366

roblabla commented 8 years ago

This filter probably comes from old version of minecraft where the chat was limited to a subset of ASCII. http://gaming.stackexchange.com/questions/103304/allowed-symbols-characters-in-minecraft-chat

This probably changed when they switched minecraft chat to JSON.