This is not a bug, but simply an encoding issue. The Lua string functions assume your input sequence is ASCII, but you used UTF8 for your .lua file.
This means the à character in your test corresponds to the two byte sequence "c3 a0" instead of "e0". According to
https://www.ascii-code.com/ "c3" is "Latin capital letter A with tilde" and "a0" "Non-breaking space". The game font cannot properly render the first one since it uses utf8 instead of ASCII, so it shows a box instead and the space is handled by gmatch.
Try to convert your .lua file to ASCII and it should work as expected although it will break any "real" UTF8 strings you use and the letter will be rendered as a box unless you use a custom font.