diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java
index 43ce7001a..ff2e6a793 100644
--- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java
+++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java
@@ -12,7 +12,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
-* License along with this library.
+ * License along with this library.
*/
package com.jpexs.decompiler.flash.xfl;
@@ -104,6 +104,7 @@ import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
import com.jpexs.decompiler.flash.types.sound.MP3FRAME;
import com.jpexs.decompiler.flash.types.sound.MP3SOUNDDATA;
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
+import com.jpexs.helpers.Helper;
import com.jpexs.helpers.Path;
import com.jpexs.helpers.SerializableImage;
import com.jpexs.helpers.utf8.Utf8Helper;
@@ -217,8 +218,8 @@ public class XFLConverter {
+ ""
- + ""
- + "");
+ + ""
+ + "");
}
private static void convertLineStyle(HashMap characters, LINESTYLE2 ls, int shapeNum, StringBuilder ret) {
@@ -1051,7 +1052,7 @@ public class XFLConverter {
ret.append("");
ret.append("");
@@ -2004,7 +2005,7 @@ public class XFLConverter {
if (hasAllRanges) {
embedRanges = "9999";
}
- ret2.append("");
+ ret2.append("");
}
}
@@ -2190,7 +2191,7 @@ public class XFLConverter {
if (ret2.length() > 0) {
ret.append(""
+ "").append(ret2).append(""
- + "");
+ + "");
}
}
@@ -2402,7 +2403,7 @@ public class XFLConverter {
ret.append(" fontRenderingMode=\"").append(fontRenderingMode).append("\"");
}
if (instanceName != null) {
- ret.append(" instanceName=\"").append(xmlString(instanceName)).append("\"");
+ ret.append(" instanceName=\"").append(Helper.escapeHTML(instanceName)).append("\"");
}
ret.append(antiAlias);
Map attrs = TextTag.getTextRecordsAttributes(textRecords, swf);
@@ -2469,7 +2470,7 @@ public class XFLConverter {
firstRun = false;
if (font != null) {
ret.append("");
- ret.append("").append(xmlString((newline ? "\r" : "") + rec.getText(font))).append("");
+ ret.append("").append(Helper.escapeHTML((newline ? "\r" : "") + rec.getText(font))).append("");
ret.append("");
ret.append("");
- ret.append("").append(xmlString(txt)).append("");
+ ret.append("").append(Helper.escapeHTML(txt)).append("");
int leftMargin = -1;
int rightMargin = -1;
int indent = -1;
@@ -2844,7 +2845,7 @@ public class XFLConverter {
publishSettings.append(" 0\n");
publishSettings.append(" 0\n");
publishSettings.append(" ").append(useNetwork ? 1 : 0).append("\n");
- publishSettings.append(" ").append(xmlString(characterClasses.containsKey(0) ? characterClasses.get(0) : "")).append("\n");
+ publishSettings.append(" ").append(Helper.escapeHTML(characterClasses.containsKey(0) ? characterClasses.get(0) : "")).append("\n");
publishSettings.append(" 2\n");
publishSettings.append(" 4\n");
publishSettings.append(" 4096\n");
@@ -3171,10 +3172,6 @@ public class XFLConverter {
return tparser.result;
}
- private static String xmlString(String s) {
- return s.replace("<", "<").replace(">", ">").replace("\"", """).replace("&", "&").replace("\r\n", "
").replace("\r", "
").replace("\n", "
");
- }
-
private static double twipToPixel(double tw) {
return tw / SWF.unitDivisor;
}
@@ -3383,7 +3380,7 @@ public class XFLConverter {
private void putText(String txt) {
result += "";
- result += "" + xmlString(txt) + "";
+ result += "" + Helper.escapeHTML(txt) + "";
result += "";
result += "", "\"", "'", "/"};
- String[] to = new String[]{"&", "<", ">", """, "'", "/"};
+ String[] from = new String[]{"&", "<", ">", "\"", "'", "/", "\r\n", "\r", "\n"};
+ String[] to = new String[]{"&", "<", ">", """, "'", "/", "
", "
", "
"};
for (int i = 0; i < from.length; i++) {
text = text.replace(from[i], to[i]);
}