matlab::cpplib::convertUTF16StringToUTF8String
Convert UTF-16 string to UTF-8 string
Description
std::string & str convertUTF16StringToUTF8String(const std::u16string
& ustr)
Convert a UTF-16 string to a UTF-8 string. Since ASCII is a subset of UTF-8 encoding, the output is ASCII content as long as no non-ASCII characters are present in the input.
Parameters
| A UTF-16 string. |
Return Value
| A UTF-8 string. |
Exceptions
| Input is not valid UTF-16 string. |
Examples
Convert a UTF-16 String to UTF-8 String
auto app = initMATLABApplication(MATLABApplicationMode::OUT_OF_PROCESS); auto mylib = initMATLABLibrary(app, convertUTF8StringToUTF16String("mylib")); std::u16string ustr = mylib->feval<std::u16string>("get_const_str"); std::string str = convertUTF16StringToUTF8String(ustr);
Version History
Introduced in R2017b
See Also
matlab::cpplib::convertUTF8StringToUTF16String
| matlab::cpplib::initMATLABApplication
| matlab::cpplib::runMain
| matlab::cpplib::initMATLABLibrary
| matlab::cpplib::initMATLABLibraryAsync
| matlab::cpplib::MATLABLibrary::feval
| matlab::cpplib::MATLABLibrary::fevalAsync
| matlab::cpplib::MATLABLibrary::waitForFiguresToClose