From: Daniel Kirschten Date: Wed, 30 Oct 2019 21:21:58 +0000 (+0100) Subject: MicroInstructionMemoryParser and MainMemoryParser now use UTF-8 X-Git-Url: https://mograsim.net/gitweb/?p=Mograsim.git;a=commitdiff_plain;h=de13257cc0764cb413ca33855c1640f01e720a3e MicroInstructionMemoryParser and MainMemoryParser now use UTF-8 --- diff --git a/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java b/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java index a141a86a..3cf971a1 100644 --- a/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java +++ b/plugins/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java @@ -6,6 +6,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import net.mograsim.machine.mi.parameters.MicroInstructionParameter; import net.mograsim.machine.mi.parameters.ParameterClassification; @@ -49,7 +50,7 @@ public class MicroInstructionMemoryParser */ public static void parseMemory(final MicroInstructionMemory memory, InputStream input) throws IOException { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(input))) + try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) { MicroInstructionMemoryDefinition def = memory.getDefinition(); MicroInstructionDefinition miDef = def.getMicroInstructionDefinition(); @@ -129,7 +130,8 @@ public class MicroInstructionMemoryParser int val = instStream.read(); if (val == -1 && instIndex <= maxAddress) { - instStream = new ByteArrayInputStream((toCSV(memory.getCell(instIndex++)) + lineSeparator).getBytes()); + instStream = new ByteArrayInputStream( + (toCSV(memory.getCell(instIndex++)) + lineSeparator).getBytes(StandardCharsets.UTF_8)); val = instStream.read(); } return val; diff --git a/plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java b/plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java index d52efdcf..c3b0d689 100644 --- a/plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java +++ b/plugins/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MainMemoryParser.java @@ -6,6 +6,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import net.mograsim.logic.core.types.BitVector; import net.mograsim.machine.MainMemory; @@ -50,7 +51,7 @@ public class MainMemoryParser */ public static void parseMemory(final MainMemory memory, InputStream input) throws IOException { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(input))) + try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) { MainMemoryDefinition def = memory.getDefinition(); @@ -86,7 +87,8 @@ public class MainMemoryParser int val = instStream.read(); if (val == -1 && instIndex <= maxAddress) { - instStream = new ByteArrayInputStream((memory.getCell(instIndex++).toBitstring() + lineSeparator).getBytes()); + instStream = new ByteArrayInputStream( + (memory.getCell(instIndex++).toBitstring() + lineSeparator).getBytes(StandardCharsets.UTF_8)); val = instStream.read(); } return val;