7 ms·
Correct – but that’s exactly why you can’t just say “all strings are UTF-8, we’re done here”. Because Windows filenames can contain unpaired surrogates, which
by comex 3y ago
Correct – but that’s exactly why you can’t just say “all strings are UTF-8, we’re done here”. Because Windows filenames can contain unpaired surrogates, which don’t have a sensible UTF-8 translation. (Unix has a similar problem with filenames being arbitrary bytes that may not be valid UTF-8.)
Note that Rust has OsString to handle both of these cases, but it’s somewhat hard to use.
- masfuerte 3y agoWith networking code you sometimes need an OsString for the platform you're not on. Rust doesn't seem to support this, other than by writing your own.