From 30c58b69d8be3a820a0528f9eb4f00736c88d901 Mon Sep 17 00:00:00 2001 From: "huangyu.hy" Date: Mon, 9 Apr 2018 21:56:49 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20#44=EF=BC=8C=E7=BC=96=E8=AF=91=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/libra/virtualview/compiler/StringStore.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/virtual-compiler/src/main/java/com/libra/virtualview/compiler/StringStore.java b/virtual-compiler/src/main/java/com/libra/virtualview/compiler/StringStore.java index 40beb54..86e7ee4 100644 --- a/virtual-compiler/src/main/java/com/libra/virtualview/compiler/StringStore.java +++ b/virtual-compiler/src/main/java/com/libra/virtualview/compiler/StringStore.java @@ -30,6 +30,7 @@ import com.libra.virtualview.common.StringBase; import com.libra.virtualview.compiler.alert.Assert; +import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -95,7 +96,12 @@ public int storeToFile(RandomAccessMemByte file) { while (iterator.hasNext()) { String string = iterator.next(); int index = mSingleOutputString2Index.get(string); - byte[] bs = string.getBytes(); + byte[] bs = new byte[0]; + try { + bs = string.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } file.writeInt(index); file.writeShort(bs.length); file.write(bs);