mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Don't decode redundant UTF-8 sequences in Win32.
Linux and OS X are working well and won't be affected.
This commit is contained in:
parent
2651372291
commit
7b8d576bde
@ -88,7 +88,7 @@ namespace
|
||||
#ifdef _WIN32
|
||||
|
||||
len = ::MultiByteToWideChar(
|
||||
CP_UTF8, 0, src, static_cast<int>(srcLength), dst, static_cast<int>(dstLength));
|
||||
CP_UTF8, MB_ERR_INVALID_CHARS, src, static_cast<int>(srcLength), dst, static_cast<int>(dstLength));
|
||||
|
||||
#else
|
||||
|
||||
|
@ -50,6 +50,7 @@ class TestString : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testEncodeNonLatin1);
|
||||
CPPUNIT_TEST(testEncodeEmpty);
|
||||
CPPUNIT_TEST(testIterator);
|
||||
CPPUNIT_TEST(testRedundantUTF8);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -321,6 +322,14 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(L'I', *it2);
|
||||
}
|
||||
|
||||
void testRedundantUTF8()
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL(String("/"), String(ByteVector("\x2F"), String::UTF8));
|
||||
CPPUNIT_ASSERT(String(ByteVector("\xC0\xAF"), String::UTF8).isEmpty());
|
||||
CPPUNIT_ASSERT(String(ByteVector("\xE0\x80\xAF"), String::UTF8).isEmpty());
|
||||
CPPUNIT_ASSERT(String(ByteVector("\xF0\x80\x80\xAF"), String::UTF8).isEmpty());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestString);
|
||||
|
Loading…
Reference in New Issue
Block a user