Fix broken tests

This was SVN commit r7211.
This commit is contained in:
Ykkrosh 2009-11-24 15:36:08 +00:00
parent ab14b71a76
commit 455137afed
3 changed files with 8 additions and 7 deletions

View File

@ -50,7 +50,8 @@ CStr8::CStr8(const CStrW& wideStr) : std:: string(wideStr.begin(), wideStr.end()
**/
CStr8 CStrW::ToUTF8() const
{
return utf8_from_wstring(*this);
LibError err;
return utf8_from_wstring(*this, &err);
}
/**
@ -60,7 +61,8 @@ CStr8 CStrW::ToUTF8() const
**/
CStrW CStr8::FromUTF8() const
{
return wstring_from_utf8(*this);
LibError err;
return wstring_from_utf8(*this, &err);
}
#else

View File

@ -159,9 +159,8 @@ public:
#endif
// Conversion to/from UTF-8, encoded in a CStr8.
// Common non-ASCII characters are handled correctly.
// Characters outside the BMP (above 0xFFFF) are *not* handled correctly.
// FromUTF8 will silently convert invalid bytes to U+FFFD replacement characters.
// Invalid bytes/characters (e.g. broken UTF-8, and Unicode characters
// above U+FFFF) are silently replaced with U+FFFD.
#ifdef _UNICODE
CStr8 ToUTF8() const;
#else

View File

@ -33,7 +33,7 @@ public:
0x7890,
0x9abc,
0xbcde,
0xfffe
0xfffd
};
const unsigned char chr_utf8[] = {
0x12,
@ -44,7 +44,7 @@ public:
0xe7, 0xa2, 0x90,
0xe9, 0xaa, 0xbc,
0xeb, 0xb3, 0x9e,
0xef, 0xbf, 0xbe
0xef, 0xbf, 0xbd
};
CStrW str_utf16 (chr_utf16, sizeof(chr_utf16)/sizeof(wchar_t));