Closed
Description
openedon Sep 24, 2019
If you have a Vec<u8>
of utf8 data there's three ways to get a String
:
from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error>
from_utf8_lossy(v: &'a [u8]) -> Cow<'a, str>
unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String
There doesn't appear to be any way to hand over the existing Vec<u8>
and have any necessary character changes into �
be done in place. The std::string::FromUtf8Error
type doesn't, for example, have a way to just do a lossy in-place conversion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment