diff options
-rw-r--r-- | tools/aapt2/ResourceParser_test.cpp | 5 | ||||
-rw-r--r-- | tools/aapt2/util/Util.cpp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp index 5352ca8679b3..c6382b177f42 100644 --- a/tools/aapt2/ResourceParser_test.cpp +++ b/tools/aapt2/ResourceParser_test.cpp @@ -843,4 +843,9 @@ TEST_F(ResourceParserTest, ParseElementWithNoValue) { EXPECT_THAT(*str->value, Eq("")); } +TEST_F(ResourceParserTest, ParsePlatformIndependentNewline) { + std::string input = R"(<string name="foo">%1$s %n %2$s</string>)"; + ASSERT_TRUE(TestParse(input)); +} + } // namespace aapt diff --git a/tools/aapt2/util/Util.cpp b/tools/aapt2/util/Util.cpp index cf2232254ec4..28e952e25a67 100644 --- a/tools/aapt2/util/Util.cpp +++ b/tools/aapt2/util/Util.cpp @@ -203,7 +203,7 @@ bool VerifyJavaStringFormat(const StringPiece& str) { if (*c == '%' && c + 1 < end) { c++; - if (*c == '%') { + if (*c == '%' || *c == 'n') { c++; continue; } |