mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-07 10:35:52 +01:00
ResXmlEncoders::encodeAsXmlValue() : properly encode strings with styles and new lines.
This commit is contained in:
parent
8dcbe6ead7
commit
0f251a0fd9
@ -81,12 +81,16 @@ public final class ResXmlEncoders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isInStyleTag = false;
|
boolean isInStyleTag = false;
|
||||||
|
int startPos = 0;
|
||||||
boolean enclose = false;
|
boolean enclose = false;
|
||||||
boolean wasSpace = true;
|
boolean wasSpace = true;
|
||||||
for (char c : chars) {
|
for (char c : chars) {
|
||||||
if (isInStyleTag) {
|
if (isInStyleTag) {
|
||||||
if (c == '>') {
|
if (c == '>') {
|
||||||
isInStyleTag = false;
|
isInStyleTag = false;
|
||||||
|
startPos = out.length() + 1;
|
||||||
|
enclose = false;
|
||||||
|
wasSpace = true;
|
||||||
}
|
}
|
||||||
} else if (c == ' ') {
|
} else if (c == ' ') {
|
||||||
if (wasSpace) {
|
if (wasSpace) {
|
||||||
@ -108,6 +112,9 @@ public final class ResXmlEncoders {
|
|||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
isInStyleTag = true;
|
isInStyleTag = true;
|
||||||
|
if (enclose || wasSpace) {
|
||||||
|
out.insert(startPos, '"').append('"');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!isPrintableChar(c)) {
|
if (!isPrintableChar(c)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user