Merge pull request #794 from TsudaKageyu/utf8-library

Replace unicode.h/unicode.cpp by the UTF8-CPP library.
This commit is contained in:
Tsuda Kageyu
2017-01-30 12:54:43 +09:00
committed by GitHub
7 changed files with 688 additions and 552 deletions

View File

@ -49,6 +49,7 @@ class TestString : public CppUnit::TestFixture
CPPUNIT_TEST(testUpper);
CPPUNIT_TEST(testEncodeNonLatin1);
CPPUNIT_TEST(testEncodeEmpty);
CPPUNIT_TEST(testEncodeNonBMP);
CPPUNIT_TEST(testIterator);
CPPUNIT_TEST(testInvalidUTF8);
CPPUNIT_TEST_SUITE_END();
@ -313,6 +314,13 @@ public:
CPPUNIT_ASSERT(empty.to8Bit(true).empty());
}
void testEncodeNonBMP()
{
const ByteVector a("\xFF\xFE\x3C\xD8\x50\xDD\x40\xD8\xF5\xDC\x3C\xD8\x00\xDE", 14);
const ByteVector b("\xF0\x9F\x85\x90\xF0\xA0\x83\xB5\xF0\x9F\x88\x80");
CPPUNIT_ASSERT_EQUAL(b, String(a, String::UTF16).data(String::UTF8));
}
void testIterator()
{
String s1 = "taglib string";