summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser_test.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-06-27 18:39:07 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-06-29 18:17:35 -0700
commit549e437e14f3b92f02bd3abc7d1cd68387132ce1 (patch)
treeb7f1e2089d81ad530b1e78914ad97bdedfeaa9c7 /tools/aapt2/ResourceParser_test.cpp
parent2fa4a346ecea162d3e694c2c53582f3cc31bcc68 (diff)
AAPT2: Iterate over UTF-8 string by codepoints
Iterating over a UTF-8 string by codepoints ensures that unicode characters do not get sliced. Otherwise the resulting string could contain malformed characters. Bug: 62839202 Test: make aapt2_tests Change-Id: Ia0c44fbceb7dcfa11e77a1a77011da0f5466e342
Diffstat (limited to 'tools/aapt2/ResourceParser_test.cpp')
-rw-r--r--tools/aapt2/ResourceParser_test.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp
index e18914410871..d47a529036bc 100644
--- a/tools/aapt2/ResourceParser_test.cpp
+++ b/tools/aapt2/ResourceParser_test.cpp
@@ -95,6 +95,11 @@ TEST_F(ResourceParserTest, ParseEscapedString) {
ASSERT_THAT(str, NotNull());
EXPECT_THAT(*str, StrValueEq("?123"));
EXPECT_THAT(str->untranslatable_sections, IsEmpty());
+
+ ASSERT_TRUE(TestParse(R"(<string name="bar">This isn\’t a bad string</string>)"));
+ str = test::GetValue<String>(&table_, "string/bar");
+ ASSERT_THAT(str, NotNull());
+ EXPECT_THAT(*str, StrValueEq("This isn’t a bad string"));
}
TEST_F(ResourceParserTest, ParseFormattedString) {