Skip to content

Replace Rust strings with byte arrays#7

Open
csnover wants to merge 1 commit intoreloginn:mainfrom
csnover:byte-strings
Open

Replace Rust strings with byte arrays#7
csnover wants to merge 1 commit intoreloginn:mainfrom
csnover:byte-strings

Conversation

@csnover
Copy link

@csnover csnover commented Aug 31, 2025

Lua strings are not UTF-8 and so it is incorrect to use Rust strings. In particular, some Lua libraries specifically designed to add support for Unicode, like ustring, use string.find to look for non-ASCII characters in Lua strings, which is impossible to do when Lua strings are treated as UTF-8 (a character set of [\x80-\xff] is ill-formed).

This is an API-breaking change.

Note that downstream consumers like piccolo will now convert using IntoValue for Vec<T> instead of IntoValue for StdString and so those need to be changed to call ctx.intern explicitly instead of relying on the auto-conversion.

Lua strings are not UTF-8 and so it is incorrect to use Rust
strings. In particular, some Lua libraries specifically designed
to add support for Unicode, like ustring, use `string.find` to look
for non-ASCII characters in Lua strings, which is impossible to do
when Lua strings are treated as UTF-8 (a character set of
`[\x80-\xff]` is ill-formed).

This is an API-breaking change.

Note that downstream consumers like piccolo will now convert using
`IntoValue for Vec<T>` instead of `IntoValue for StdString` and
so those need to be changed to call `ctx.intern` explicitly instead
of relying on the auto-conversion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant