calvert1991/android4me

Can not handle UTF16 strings

Opened this issue · 0 comments

What steps will reproduce the problem?
1. When decode binary AndroidManifest.xml which contains UTF8 strings, it fails:

$ java -jar ~/Downloads/AXMLPrinter2.jar tmp/2/AndroidManifest.xml 
<?xml version="1.0" encoding="utf-8"?>
java.lang.ArrayIndexOutOfBoundsException: 962
    at android.content.res.StringBlock.getShort(StringBlock.java:231)
    at android.content.res.StringBlock.getString(StringBlock.java:91)
    at android.content.res.AXmlResourceParser.getName(AXmlResourceParser.java:140)
    at test.AXMLPrinter.main(AXMLPrinter.java:56)

What is the expected output?
 Normal text xml.

 What do you see instead?
  Error

What version of the product are you using?
 2

 On what operating system?
 Mac OS X 10.9.3

Please provide any additional information below.
 The container APK works fine in device, so the AndroidManifest.xml should have no problem.
 Normally,  AndroidManifest.xml generated by aapt will encode strings as UTF16, but some tools such as AXMLWriter produce UTF8 strings by default.

Original issue reported on code.google.com by osexp2...@gmail.com on 22 May 2014 at 7:29

Attachments: