diff options
| author | 2022-05-01 22:25:03 +0000 | |
|---|---|---|
| committer | 2022-05-01 22:28:21 +0000 | |
| commit | 27e9a4a85fe74bf13614396bb681967b53924f90 (patch) | |
| tree | a8cf108262ab7b7c1858153c6bcffb8352bdeb58 | |
| parent | c90f42c80fc9472ad1b46402672c0444b0365f49 (diff) | |
Revert "Escape single quotes in aapt2"
This reverts commit c90f42c80fc9472ad1b46402672c0444b0365f49.
Reason for revert: Introduces the escaping *into the APKs*; as mentioned in b/140373430#comment3 the Right Way to dump XML is via textproto.
Fix: 222745626
Bug: 140373430
Change-Id: I775b8a304e76a83934c36886c17cf23560914d21
| -rw-r--r-- | tools/aapt2/xml/XmlDom.cpp | 3 | ||||
| -rw-r--r-- | tools/aapt2/xml/XmlDom_test.cpp | 13 |
2 files changed, 1 insertions, 15 deletions
diff --git a/tools/aapt2/xml/XmlDom.cpp b/tools/aapt2/xml/XmlDom.cpp index dd60f1717de7..8b7eadf9fac9 100644 --- a/tools/aapt2/xml/XmlDom.cpp +++ b/tools/aapt2/xml/XmlDom.cpp @@ -349,8 +349,7 @@ std::unique_ptr<XmlResource> Inflate(const void* data, size_t len, std::string* size_t len; const char16_t* str16 = tree.getText(&len); if (str16) { - text->text = - ResTable::normalizeForOutput(util::Utf16ToUtf8(StringPiece16(str16, len)).c_str()); + text->text = util::Utf16ToUtf8(StringPiece16(str16, len)); } CHECK(!node_stack.empty()); node_stack.top()->AppendChild(std::move(text)); diff --git a/tools/aapt2/xml/XmlDom_test.cpp b/tools/aapt2/xml/XmlDom_test.cpp index 3a2d656240bb..6c717dcd84c8 100644 --- a/tools/aapt2/xml/XmlDom_test.cpp +++ b/tools/aapt2/xml/XmlDom_test.cpp @@ -139,19 +139,6 @@ TEST(XmlDomTest, XmlEscapeSequencesAreParsed) { EXPECT_THAT(attr->value, Eq("\"")); } -TEST(XmlDomTest, XmlEscapeSingleQuotes) { - std::unique_ptr<XmlResource> doc = test::BuildXmlDom(R"( - <foo><![CDATA[oh no' (line=1001) -E: this-is-not-an-element (line=88) - T: 'blah]]></foo>)"); - - Element* el = doc->root.get(); - Text* text = xml::NodeCast<xml::Text>(el->children[0].get()); - ASSERT_THAT(text, NotNull()); - EXPECT_THAT(text->text, - Eq("oh no' (line=1001)\nE: this-is-not-an-element (line=88)\n T: 'blah")); -} - class TestVisitor : public PackageAwareVisitor { public: using PackageAwareVisitor::Visit; |