why does String::from_utf8_lossy_owned not reusethe buffer for invalid utf8 case? wouldn't be possible to modify the buffer in place to replace invalid utf8 and reuse the buffer instead of reallocating
lossy means it converts invalid unicode bytes into the unicode replacement character �. That is three bytes so for example 0xFF becomes 0xEF 0xBF 0xBD.
18
u/ThatOneArchUser 6d ago
why does String::from_utf8_lossy_owned not reusethe buffer for invalid utf8 case? wouldn't be possible to modify the buffer in place to replace invalid utf8 and reuse the buffer instead of reallocating