From c5a8f0c8a54d8793c30c4f43dfdb19e1f5953b15 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sun, 9 Feb 2014 18:49:32 -0600 Subject: [PATCH] don't write a trailing /u0000 if its the last char of the string --- .../src/main/java/brut/androlib/res/xml/ResXmlEncoders.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java index a7531329..0d2fa7db 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/xml/ResXmlEncoders.java @@ -121,6 +121,11 @@ public final class ResXmlEncoders { break; default: if (!isPrintableChar(c)) { + + // lets not write trailing \u0000 if we are at end of string + if ((out.length() + 1) == str.length() && c == '\u0000') { + continue; + } out.append(String.format("\\u%04x", (int) c)); continue; } @@ -132,7 +137,6 @@ public final class ResXmlEncoders { if (enclose || wasSpace) { out.insert(startPos, '"').append('"'); } - return out.toString(); }