What would be the algorithm/implementation of the C++ code C++functionX in the following flow chart:
(JavaString) --getBytes--> (bytes) --C++functionX--> (C++String)
JavaString contents should match C++String contents as far as possible (preferably 100% for all possible values of JavaString)
[EDIT] The endianness of bytes can be ignored as there are ways to handle that.
Java:
C++:
To do this in linux, one uses the iconv library, which is incredibly powerful, but more difficult to use. Here’s a function that converts a
std::stringin UTF8 to astd::wstringin UTF32: http://coliru.stacked-crooked.com/view?id=986a4a07e391213559d4e65acaf231d5-e54ee7a04e4b807da0930236d4cc94dc