ava-cassiopeia / discord-text-adventure-bot

A bot for Discord to play text adventure games in Discord
ISC License
45 stars 7 forks source link

don't encode UTF-8 #36

Open Oreolek opened 5 years ago

Oreolek commented 5 years ago

My terminal locale is UTF-8, my dfrotz puts plain Unicode (not ASCII) output, so the bot encodes Unicode twice into gibberish.

Here's a patch: src/MessageHandler.js, like 310

-    var final = stripAnsi(utf8.encode(this.compiledOutput));
+    var final = stripAnsi(this.compiledOutput);
ava-cassiopeia commented 5 years ago

Thanks for submitting a bug, this is good to know, and I will try to address it when I can.

The UTF-8 encoding is necessary for non-UTF-8 locale terminals, so there will need to be some sort of locale checking involved in this as well.