From c4970cc4addedd4565cf8c3ed9ea92b6a4487e0c Mon Sep 17 00:00:00 2001 From: Thomas Guillemard Date: Fri, 12 Aug 2016 19:23:54 +0200 Subject: Implement Enigma directory format (#1) Others changes: ~ Rework File menu ~ Force UTF-8 for all I/O operations ~ Enigma now detect the original file format and use the correct one when you save a mapping--- .../java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/java/cuchaz/enigma/bytecode') diff --git a/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java b/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java index 0ea2d02..474a3ef 100644 --- a/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java +++ b/src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java @@ -11,10 +11,13 @@ package cuchaz.enigma.bytecode.accessors; import java.io.ByteArrayOutputStream; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.lang.reflect.Field; import java.lang.reflect.Method; +import com.google.common.base.Charsets; import cuchaz.enigma.bytecode.InfoType; public class ConstInfoAccessor { @@ -56,12 +59,12 @@ public class ConstInfoAccessor { public String toString() { try { ByteArrayOutputStream buf = new ByteArrayOutputStream(); - PrintWriter out = new PrintWriter(buf); + PrintWriter out = new PrintWriter(new OutputStreamWriter(buf, Charsets.UTF_8)); Method print = this.item.getClass().getMethod("print", PrintWriter.class); print.setAccessible(true); print.invoke(this.item, out); out.close(); - return buf.toString().replace("\n", ""); + return buf.toString("UTF-8").replace("\n", ""); } catch (Exception ex) { throw new Error(ex); } -- cgit v1.2.3