修复读取json会出现乱码的问题

This commit is contained in:
Yutousama 2020-02-26 17:36:17 +08:00
parent c58b890c61
commit 520ea8cff4
3 changed files with 9 additions and 12 deletions

3
src/META-INF/MANIFEST.MF Normal file
View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.qy.ui.AppMain

View File

@ -64,7 +64,7 @@ public class ChuanShanJiaUi {
}
}else{
append("没有找到穿山甲demo请将穿山甲demo放置在 input"+File.separator+"csjDemo文件夹中");
csjDemo.mkdirs();
csjPath.mkdirs();
}
}
}

View File

@ -1,14 +1,7 @@
package com.qy.utils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import org.json.JSONObject;
@ -130,9 +123,9 @@ public class Tools {
e.printStackTrace();
}
} else {
try {
reader = new BufferedReader(new FileReader(file));
String tmp, str = "";
try {
reader = new BufferedReader( new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
while ((tmp = reader.readLine()) != null) {
str += tmp;
}
@ -140,6 +133,7 @@ public class Tools {
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(str);
}
}
return json;