Found during automated differential review of PR #406 (not caused by it).
print (and io writes) of a binary that is not valid UTF-8 raises Lua.RuntimeException (:io.put_chars argument error) where PUC-Lua 5.3 writes the raw bytes:
print(("日本"):gsub("^.", "X")) -- crashes; the gsub result itself is byte-identical to PUC
Lua strings are byte strings; any byte-slicing produces non-UTF-8 binaries routinely, so this affects ordinary programs. Likely fix: write via IO.binwrite/latin1-safe path instead of :io.put_chars with unicode translation.
🤖 Filed from an automated review pass.
Found during automated differential review of PR #406 (not caused by it).
print(and io writes) of a binary that is not valid UTF-8 raisesLua.RuntimeException(:io.put_charsargument error) where PUC-Lua 5.3 writes the raw bytes:Lua strings are byte strings; any byte-slicing produces non-UTF-8 binaries routinely, so this affects ordinary programs. Likely fix: write via
IO.binwrite/latin1-safe path instead of:io.put_charswith unicode translation.🤖 Filed from an automated review pass.