UTF8 characters with HaveItem
Posted: Thu Nov 02, 2023 8:55 am
HaveItem() doesn't find string indices that contain non-english or some special characters if the script is run in the default UTF-8 mode. If you save the file as ASCII and add "@OPTIONS {Encoding = #ENCODING_ISO8859_1}" in the beginning, then it works just fine with the same characters.
I think that if a character is a two-byte UTF-8 character then it doesn't work, but if it's ASCII character then it works even if it'd be a special character like "@" which is represented with a single byte even in UTF-8.
Is this something fixable?
I think that if a character is a two-byte UTF-8 character then it doesn't work, but if it's ASCII character then it works even if it'd be a special character like "@" which is represented with a single byte even in UTF-8.
Is this something fixable?
Code: Select all
t = {}
t["ä"] = "test-ä"
DebugPrint(t["ä"]) ; Works
DebugPrint(RawGet(t, "ä")) ; Works
DebugPrint(HaveItem(t, "ä")) ; Doesn't work
t["®"] = "test-®"
DebugPrint(t["®"]) ; Works
DebugPrint(RawGet(t, "®")) ; Works
DebugPrint(HaveItem(t, "®")) ; Doesn't work
t["@"] = "test-@"
DebugPrint(t["@"]) ; Works
DebugPrint(RawGet(t, "@")) ; Works
DebugPrint(HaveItem(t, "@")) ; Works