handle a crash condition when I receive non-convertible utf-8 text

This commit is contained in:
zeromus 2008-08-17 19:27:58 +00:00
parent 4bd3881f1b
commit 224d9268ef
1 changed files with 5 additions and 1 deletions

View File

@ -679,7 +679,11 @@ namespace UtfConverter
//convert a std::string to std::wstring
std::wstring mbstowcs(std::string str)
{
return UtfConverter::FromUtf8(str);
try {
return UtfConverter::FromUtf8(str);
} catch(std::exception) {
return L"(failed UTF-8 conversion)";
}
}
std::string wcstombs(std::wstring str)