diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/bytecode')
| -rw-r--r-- | src/main/java/cuchaz/enigma/bytecode/accessors/ConstInfoAccessor.java | 7 |
1 files changed, 5 insertions, 2 deletions
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 @@ | |||
| 11 | package cuchaz.enigma.bytecode.accessors; | 11 | package cuchaz.enigma.bytecode.accessors; |
| 12 | 12 | ||
| 13 | import java.io.ByteArrayOutputStream; | 13 | import java.io.ByteArrayOutputStream; |
| 14 | import java.io.FileOutputStream; | ||
| 15 | import java.io.OutputStreamWriter; | ||
| 14 | import java.io.PrintWriter; | 16 | import java.io.PrintWriter; |
| 15 | import java.lang.reflect.Field; | 17 | import java.lang.reflect.Field; |
| 16 | import java.lang.reflect.Method; | 18 | import java.lang.reflect.Method; |
| 17 | 19 | ||
| 20 | import com.google.common.base.Charsets; | ||
| 18 | import cuchaz.enigma.bytecode.InfoType; | 21 | import cuchaz.enigma.bytecode.InfoType; |
| 19 | 22 | ||
| 20 | public class ConstInfoAccessor { | 23 | public class ConstInfoAccessor { |
| @@ -56,12 +59,12 @@ public class ConstInfoAccessor { | |||
| 56 | public String toString() { | 59 | public String toString() { |
| 57 | try { | 60 | try { |
| 58 | ByteArrayOutputStream buf = new ByteArrayOutputStream(); | 61 | ByteArrayOutputStream buf = new ByteArrayOutputStream(); |
| 59 | PrintWriter out = new PrintWriter(buf); | 62 | PrintWriter out = new PrintWriter(new OutputStreamWriter(buf, Charsets.UTF_8)); |
| 60 | Method print = this.item.getClass().getMethod("print", PrintWriter.class); | 63 | Method print = this.item.getClass().getMethod("print", PrintWriter.class); |
| 61 | print.setAccessible(true); | 64 | print.setAccessible(true); |
| 62 | print.invoke(this.item, out); | 65 | print.invoke(this.item, out); |
| 63 | out.close(); | 66 | out.close(); |
| 64 | return buf.toString().replace("\n", ""); | 67 | return buf.toString("UTF-8").replace("\n", ""); |
| 65 | } catch (Exception ex) { | 68 | } catch (Exception ex) { |
| 66 | throw new Error(ex); | 69 | throw new Error(ex); |
| 67 | } | 70 | } |