Remix.run Logo
pansa2 11 hours ago

> all the encoding/decoding functions default to utf-8

Languages that use UTF-8 natively don't need those functions at all. And the ones in Python aren't trivial - see, for example, `surrogateescape`.

As the sibling comment says, the only benefit of all this encoding/decoding is that it allows strings to support constant-time indexing of code points, which isn't something that's commonly needed.

laurencerowe 10 hours ago | parent [-]

They absolutely do because random byte strings are not valid utf8. Safe Rust requires validating bytes when converting to strings because this.