Hello,
I am facing a difficulty in differentiating binary buffers from true strings in my application with Lua 5.3 embedded.
I use the org.conman.cbor library to send CBOR payloads over the network, one of whose fields is a binary buffer (Lua string). Due to Lua strings being just bytes buffers, the org.conman.cbor library will try to detect if the Lua string is actually a text (valid UTF-8) string, and in that case use the CBOR TEXT type, otherwise it will use the CBOR BYTES type.
This is a problem, as the binary buffer can sometimes happen to be a valid UTF-8 string, therefore the CBOR type tag can randomly be BYTES or TEXT, which turns out to be a problem for clients whose languages are aware of the string VS. bytes difference (C++, Python, Java, ...).
Are there any plans for future lua versions to natively support strings (e.g. by having the type for strings different from the type for bytes)?
Or perhaps is there a solution or workaround to deal with this in the current version of Lua?
Cheers,
Federico Ferri