im working on a tool for encoding XML animation data, and part of that is typing in the name of an animation or such, im using
Code: Select all
love.textinput(text)
Code: Select all
state.commandprev
Code: Select all
love.keypressed(key)
Code: Select all
string.sub(state.commandprev, 1, -2)
Error
main.lua UTF-8 decoding error: Invalid UTF-8
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: in function 'getWidth'
main.lua in function 'draw'
[love "callbacks.lua"]:168: in function <[love "callbacks.lua"]:144>
[C]: in function 'xpcall'
im not sure how to deal with this? ive looked on the wiki and havent found anything about it
i have 3 solutions for this but im not sure about effective implementation
- prevent them from being typed in the first place (because the generation algorithm i wrote does not handle them, and neither does XML)
- handle the crash to prevent lost progress
- convert the characters to their standard counterparts