I have a string output that ins not necessarily valid utf8. I have to pass it to a method only accepting valid utf8 strings.
Therefore I need to convert output to the closest valid utf8 string removing invalid bytes or parts. How can I do that in c++? I would like not to use a 3rd party library.
I have a string output that ins not necessarily valid utf8. I have to
Share
You should use the
icu::UnicodeStringmethodsfromUTF8(const StringPiece &utf8)ortoUTF8String(StringClass &result).