You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stdlib: print/io of a non-UTF-8 binary raises where PUC-Lua writes raw bytes #409
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.
Activity