diff --git a/trunk/src/com/jpexs/decompiler/flash/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java index 118d2112d..35e10d009 100644 --- a/trunk/src/com/jpexs/decompiler/flash/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java @@ -271,7 +271,7 @@ public class TagNode { ret = (Highlighting.stripHilights(Action.actionsToSource(as, SWF.DEFAULT_VERSION))); } try (FileOutputStream fos = new FileOutputStream(f)) { - fos.write(ret.getBytes()); + fos.write(ret.getBytes("utf-8")); } } catch (Exception ex) { } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 1345df553..2fed410bc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -110,9 +110,9 @@ public class ScriptPack { Multiname name = abc.script_info[scriptIndex].traits.traits[t].getName(abc); Namespace ns = name.getNamespace(abc.constants); if ((ns.kind == Namespace.KIND_PACKAGE) || (ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) { - fos.write(abc.script_info[scriptIndex].traits.traits[t].convertPackaged("", abcList, abc, false, pcode, scriptIndex, -1, false, new ArrayList(), paralel).getBytes()); + fos.write(abc.script_info[scriptIndex].traits.traits[t].convertPackaged("", abcList, abc, false, pcode, scriptIndex, -1, false, new ArrayList(), paralel).getBytes("utf-8")); } else { - fos.write(abc.script_info[scriptIndex].traits.traits[t].convert("", abcList, abc, false, pcode, scriptIndex, -1, false, new ArrayList(), paralel).getBytes()); + fos.write(abc.script_info[scriptIndex].traits.traits[t].convert("", abcList, abc, false, pcode, scriptIndex, -1, false, new ArrayList(), paralel).getBytes("utf-8")); } } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java index 1450809a1..7f1c3129d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.types.ScriptInfo; import com.jpexs.decompiler.flash.abc.types.traits.Trait; import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; -import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.helpers.Cache; import com.jpexs.decompiler.flash.helpers.Highlighting; import com.jpexs.decompiler.flash.tags.ABCContainerTag; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 6bd07444a..c70f99ed1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -40,9 +40,9 @@ import com.jpexs.decompiler.flash.graph.NotItem; import com.jpexs.decompiler.flash.graph.ScriptEndItem; import com.jpexs.decompiler.flash.helpers.Helper; import com.jpexs.decompiler.flash.helpers.Highlighting; -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.StringReader; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; @@ -1239,8 +1239,7 @@ public class Action implements GraphSourceItem { String s = null; try { s = Highlighting.stripHilights(Action.actionsToString(new ArrayList(), address, ret, null, version, false, swfPos)); - - ret = ASMParser.parse(address, swfPos, true, new ByteArrayInputStream(s.getBytes()), SWF.DEFAULT_VERSION); + ret = ASMParser.parse(address, swfPos, true, new StringReader(s), SWF.DEFAULT_VERSION); } catch (Exception ex) { Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "parsing error", ex); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java index 852fe0669..acd3c7c62 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java @@ -44,8 +44,8 @@ import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.StringReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -617,7 +617,7 @@ public class ActionPanel extends JPanel implements ActionListener { setHex(hexButton.isSelected()); } else if (e.getActionCommand().equals("SAVEACTION")) { try { - src.setActions(ASMParser.parse(0, src.getPos(), true, new ByteArrayInputStream(editor.getText().getBytes()), SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION); + src.setActions(ASMParser.parse(0, src.getPos(), true, new StringReader(editor.getText()), SWF.DEFAULT_VERSION), SWF.DEFAULT_VERSION); setSource(this.src, false); JOptionPane.showMessageDialog(this, "Code successfully saved"); saveButton.setVisible(false); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java index c95ae4d24..b0d80384c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java @@ -30,7 +30,7 @@ import com.jpexs.decompiler.flash.action.swf7.*; import com.jpexs.decompiler.flash.graph.GraphSourceItemContainer; import com.jpexs.decompiler.flash.helpers.Helper; import java.io.IOException; -import java.io.InputStream; +import java.io.Reader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -331,7 +331,7 @@ public class ASMParser { } } - public static List parse(long address, long containerSWFOffset, boolean ignoreNops, InputStream is, int version) throws IOException, ParseException { + public static List parse(long address, long containerSWFOffset, boolean ignoreNops, Reader is, int version) throws IOException, ParseException { FlasmLexer lexer = new FlasmLexer(is); List