Bug - Fixed chat_notify("ſģ","blue") prints "??" in chat logs

Irrat

Member
I'd previously opened a PR about this to have the logs written in UTF-8, however every party involved became confused.
So I'm opening this as a bug instead.

When you send a message, you're limited to ISO-8859-1. Not sure on how KoL does it internally, but it will apply entity encoding to the response.
So becomes ™

You can see it reads all responses from KoL as UTF-8 here, so we definitely don't expect any other encoding.

Here, we do not specify the encoding, and so (on my system at least) it does not write in UTF-8 but instead ISO-8859-1.
So the final output will write any UTF-8 characters as ?.

This is a non-issue for KoL chat as again, it entity encodes all special characters. But the issue is with mafia, when you perform ash chat_notify("ſģ","blue") you will see it print properly in chat. But if you open your log you will note that it's been replaced with ??

This is an issue on two sides.
The first is that the chat log should be written in UTF-8. KoL itself declares chat as UTF-8, not ISO-8859-1.
The second is that the user (me) should be calling entity_encode, so ash chat_notify(entity_encode("ſģ"),"blue") will now write the message correctly.

However, this will break again when you write ash chat_notify(entity_encode("😀"),"blue"), leaving us back at the chat log not being written as UTF-8.
 
Top