Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Fix #44,编译中文乱码
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyu.hy committed Apr 9, 2018
1 parent 03b72f9 commit 30c58b6
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 30c58b6

Please sign in to comment.