From 21c990e3c75ba35c3a9e30d7b90623d0476adeb3 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Wed, 2 Jun 2010 13:11:51 +0000 Subject: [PATCH] Test for UTF8 in a Latin1 field --- tests/song_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/song_test.cpp b/tests/song_test.cpp index 2a9108a4a..2bb7524a3 100644 --- a/tests/song_test.cpp +++ b/tests/song_test.cpp @@ -129,4 +129,12 @@ TEST_F(SongTest, DoesNotFixExtendedAscii) { EXPECT_EQ(fixed, unicode); } +TEST_F(SongTest, FixesUtf8MungedIntoLatin1) { + char latin1[] = { 'E', 's', 't', 'h', 'e', 'r', 0xe2, 0x80, 0x99, 's', 0x00 }; + TagLib::String str(latin1, TagLib::String::Latin1); + QString fixed = UniversalEncodingHandler::FixEncoding(str); + EXPECT_EQ(8, fixed.length()); + EXPECT_EQ(QString::fromUtf8("Esther’s"), fixed); +} + } // namespace