Closed Commandcracker closed 1 year ago
Specifically which environments is Busted being run in that can't display an utf8 character like this?
Any Lua lexer that dos not handle utf8 characters properly. I used CraftOS-PC in headless mode.
And will this break on any other environments that currently work?
No, it won't break any other environments. Because it is basically just escaping the character.
Proof:
> for _,v in pairs({tostring("◼"):byte(1,-1)}) do print(v) end
226
151
188
> for _,v in pairs({tostring("\226\151\188"):byte(1,-1)}) do print(v) end
226
151
188
It is also a general bad practice writing none ASCII characters unescaped in code. This is the reason why python has "\N{}", it escapes the character and still keeps the readability. And one reason for Lua 5.3+ having "utf8.char".
My solution is the same as calling utf8.char. I did not use utf8.char because it was added in 5.3, and it would break on Lua version below it.