mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-23 02:35:33 +00:00
Added Setting charset in commandline (-charset XXX)
Default charset for SWF files version <= 5 is system charset
This commit is contained in:
@@ -936,11 +936,13 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void saveTo(OutputStream os) throws IOException {
|
||||
checkCharset();
|
||||
byte[] uncompressedData = saveToByteArray();
|
||||
compress(new ByteArrayInputStream(uncompressedData), os, compression, lzmaProperties);
|
||||
}
|
||||
|
||||
public void saveTo(OutputStream os, boolean gfx) throws IOException {
|
||||
checkCharset();
|
||||
byte[] uncompressedData = saveToByteArray(gfx);
|
||||
compress(new ByteArrayInputStream(uncompressedData), os, compression, lzmaProperties);
|
||||
}
|
||||
@@ -980,6 +982,12 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
private byte[] saveToByteArray() throws IOException {
|
||||
return saveToByteArray(gfx);
|
||||
}
|
||||
|
||||
private void checkCharset() {
|
||||
if (version > 5) {
|
||||
charset = Utf8Helper.charsetName;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] saveToByteArray(boolean gfx) throws IOException {
|
||||
byte[] data;
|
||||
|
||||
@@ -210,6 +210,9 @@ public class SwfXmlExporter {
|
||||
|
||||
if (obj instanceof UnknownTag) {
|
||||
writer.writeAttribute("tagId", String.valueOf(((Tag) obj).getId()));
|
||||
}
|
||||
if (obj instanceof SWF) {
|
||||
writer.writeAttribute("charset", ((SWF) obj).getCharset());
|
||||
}
|
||||
|
||||
for (Field f : fields) {
|
||||
@@ -222,6 +225,7 @@ public class SwfXmlExporter {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
writer.writeEndElement();
|
||||
} else if (isListItem) {
|
||||
writer.writeStartElement(name);
|
||||
|
||||
@@ -311,6 +311,10 @@ public class SwfXmlImporter {
|
||||
if (name.equals("tagId") && "UnknownTag".equals(attributes.get("type"))) {
|
||||
continue;
|
||||
}
|
||||
if (name.equals("charset") && "SWF".equals(attributes.get("type"))) {
|
||||
((SWF) obj).setCharset(val);
|
||||
continue;
|
||||
}
|
||||
if (!name.equals("type")) {
|
||||
try {
|
||||
Field field = getField(cls, name);
|
||||
|
||||
Reference in New Issue
Block a user