Convert Path to posix path

I want a cross-platform way to convert a relative Path into an unspecified superset of ASCII, where the output will be UTF-8 if the input is well-formed UTF-8 or UTF-16, and / is the directory separator

on unix, this just means passing through the bytes unchanged

on windows, this involves some utf-16/utf-8 transcoding

You can't tell for sure if a byte stream is UTF8 or UTF16. So you'll need to know the source platform.

If you're okay restricting windows paths to valid UTF-16, maybe bstr fulfills your needs?

no, but i can know based on if i got it from the linux or windows kernel.

windows OsStr is WTF-8, not UTF-16, so it's a moot point anyways, i just want the internal representation with slashes normalized.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.