diff --git a/CHANGELOG.md b/CHANGELOG.md index a0b1c2ae0..be7fc7de6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ All notable changes to this project will be documented in this file. - [#2437] AS1 P-code - do not group pushes automatically - [#2437] AS1 - use Constant pool only on FP5+ - [#2430] AS1/2/3 - Missing syntax hilighting of "new" keyword and few others +- [#2428] Charset setting on FLA export in format MX and below +- [#2428] Default charset for SWFS v5 and lower is WINDOWS-1252 ## [22.0.2] - 2025-01-17 ### Added @@ -3704,6 +3706,7 @@ Major version of SWF to XML export changed to 2. [#2436]: https://www.free-decompiler.com/flash/issues/2436 [#2437]: https://www.free-decompiler.com/flash/issues/2437 [#2430]: https://www.free-decompiler.com/flash/issues/2430 +[#2428]: https://www.free-decompiler.com/flash/issues/2428 [#2375]: https://www.free-decompiler.com/flash/issues/2375 [#2374]: https://www.free-decompiler.com/flash/issues/2374 [#2389]: https://www.free-decompiler.com/flash/issues/2389 diff --git a/lib/flacomdoc.jar b/lib/flacomdoc.jar index 861ab20ed..eb4041b73 100644 Binary files a/lib/flacomdoc.jar and b/lib/flacomdoc.jar differ diff --git a/libsrc/ffdec_lib/lib/flacomdoc.jar b/libsrc/ffdec_lib/lib/flacomdoc.jar index 861ab20ed..eb4041b73 100644 Binary files a/libsrc/ffdec_lib/lib/flacomdoc.jar and b/libsrc/ffdec_lib/lib/flacomdoc.jar differ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 886a63bd1..408043589 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -523,7 +523,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { * Charset for SWF files with version 5 and lower which do not use UTF-8. */ @Internal - private String charset = "UTF-8"; + private String charset = "WINDOWS-1252"; /** * Map of characterId to imported class sets. @@ -797,7 +797,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { if (Configuration.getPlayerSWC() != null) { SWC swc = new SWC(new FileInputStream(Configuration.getPlayerSWC())); //set allowRenameIdentifiers parameter to FALSE otherwise there will be an infinite loop - SWF swf = new SWF(swc.getOpenable("library.swf"), null, null, null, true, false, true, null, Charset.defaultCharset().name(), false); + SWF swf = new SWF(swc.getOpenable("library.swf"), null, null, null, true, false, true, null, "WINDOWS-1252", false); playerGlobalAbcIndex = new AbcIndexing(swf); } } @@ -805,7 +805,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { if (Configuration.getAirSWC() != null) { SWC swc = new SWC(new FileInputStream(Configuration.getAirSWC())); //set allowRenameIdentifiers to FALSE - SWF swf = new SWF(swc.getOpenable("library.swf"), null, null, null, true, false, true, null, Charset.defaultCharset().name(), false); + SWF swf = new SWF(swc.getOpenable("library.swf"), null, null, null, true, false, true, null, "WINDOWS-1252", false); airGlobalAbcIndex = new AbcIndexing(swf); } } @@ -1966,6 +1966,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { version = SWF.DEFAULT_VERSION; displayRect = new RECT(0, 1, 0, 1); dumpInfo = new DumpInfoSwfNode(this, "rootswf", "", null, 0, 0); + charset = Utf8Helper.charsetName; } /** @@ -2164,7 +2165,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { * @throws InterruptedException On interrupt */ public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy) throws IOException, InterruptedException { - this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, Charset.defaultCharset().name(), true); + this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, null, "WINDOWS-1252", true); } /** @@ -2182,7 +2183,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { * @throws InterruptedException On interrupt */ public SWF(InputStream is, String file, String fileTitle, ProgressListener listener, boolean parallelRead, boolean checkOnly, boolean lazy, UrlResolver resolver) throws IOException, InterruptedException { - this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, resolver, Charset.defaultCharset().name(), true); + this(is, file, fileTitle, listener, parallelRead, checkOnly, lazy, resolver, "WINDOWS-1252", true); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java index 5febea555..893088b17 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineBinaryDataTag.java @@ -133,7 +133,7 @@ public class DefineBinaryDataTag extends CharacterTag implements BinaryDataInter public void loadEmbeddedSwf() { String path = getSwf().getShortPathTitle() + "/DefineBinaryData (" + getCharacterId() + ")"; SwfSpecificCustomConfiguration conf = Configuration.getSwfSpecificCustomConfiguration(path); - String charset = conf == null ? Charset.defaultCharset().name() : conf.getCustomData(CustomConfigurationKeys.KEY_CHARSET, Charset.defaultCharset().name()); + String charset = conf == null ? "WINDOWS-1252" : conf.getCustomData(CustomConfigurationKeys.KEY_CHARSET, Charset.defaultCharset().name()); try { InputStream is = new ByteArrayInputStream(binaryData.getArray(), binaryData.getPos(), binaryData.getLength()); 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 96b5ea2d3..78aa1d5f0 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 @@ -6022,7 +6022,7 @@ public class XFLConverter { InputStorageInterface inputStorage = new ZippedInputStorage(new File(zipfile)); OutputStorageInterface outputStorage = new CfbOutputStorage(new File(outfile)); - FlaConverter contentsGenerator = new FlaConverter(cbfFlaVersion); + FlaConverter contentsGenerator = new FlaConverter(cbfFlaVersion, swf.getCharset()); contentsGenerator.convert(inputStorage, outputStorage); inputStorage.close(); outputStorage.close(); diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 8ed014914..0eadf3ce7 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1201,7 +1201,7 @@ public class Main { String shortName = fileTitle != null ? fileTitle : file; String fileKey = shortName == null ? "" : new File(shortName).getName(); SwfSpecificCustomConfiguration conf = Configuration.getSwfSpecificCustomConfiguration(fileKey); - String charset = conf == null ? Charset.defaultCharset().name() : conf.getCustomData(CustomConfigurationKeys.KEY_CHARSET, Charset.defaultCharset().name()); + String charset = conf == null ? Charset.defaultCharset().name() : conf.getCustomData(CustomConfigurationKeys.KEY_CHARSET, "WINDOWS-1252"); List loadedUrls = new ArrayList<>(); List loadedStatus = new ArrayList<>();