Prevents double escaping of special chars in arrays.xml/<item> tags

This commit is contained in:
Connor Tumbleson 2013-05-05 08:13:32 -05:00
parent 1449c00f76
commit f93a312308
4 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ v2.0.0 (TBA)
-Fixed (issue #439) - Correctly handles apk's that have have the general access bit enabled for encryption.
-Fixed (issue #339) - Re-enables debug mode ( -d flag) to fix smali debugging. (Thanks Ryszard)
-Fixed (issue #177) - Adapted output of smali to make breakpoint setting easier in different IDEs. (Thanks Ryszard)
-Fixed (issue #391) - Fixes characters (& and <) from being double escaped in <item>'s of arrays.xml
v1.5.3 (TBA)
-Updated to smali/baksmali to v1.4.2

View File

@ -58,7 +58,7 @@ public class ResArrayValue extends ResBagValue implements
serializer.attribute(null, "name", res.getResSpec().getName());
for (int i = 0; i < mItems.length; i++) {
serializer.startTag(null, "item");
serializer.text(mItems[i].encodeAsResXmlItemValue());
serializer.text(mItems[i].encodeAsResXmlNonEscapedItemValue());
serializer.endTag(null, "item");
}
serializer.endTag(null, type);

View File

@ -57,6 +57,10 @@ public abstract class ResScalarValue extends ResValue implements
return encodeAsResXmlValueExt().replace("@android:", "@*android:");
}
public String encodeAsResXmlNonEscapedItemValue() throws AndrolibException {
return encodeAsResXmlValue().replace("@android:", "@*android:").replace("&amp;", "&").replace("&lt;","<");
}
public String encodeAsResXmlValueExt() throws AndrolibException {
String rawValue = mRawValue;
if (rawValue != null) {

View File

@ -5,6 +5,8 @@
<item>TEST2</item>
<item>TEST3</item>
<item>%2$s foo %1$d</item>
<item>http://google.com&amp;boo=1&amp;foo=2</item>
<item>&lt;b>Bolded Text&lt;/b></item>
</string-array>
<integer-array name="test_array2">
<item>-1</item>