bugfix----大屏导入导出乱码问题

Raod 3 years ago
parent ff04e78f93
commit ffc5add008

@ -97,11 +97,13 @@ public class FileUtil {
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
FileWriter fw = new FileWriter(filePath); FileOutputStream outputStream = new FileOutputStream(filePath);
BufferedWriter bw = new BufferedWriter(fw); OutputStreamWriter outputWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8);
BufferedWriter bw = new BufferedWriter(outputWriter);
bw.write(content); bw.write(content);
bw.close(); bw.close();
fw.close(); outputWriter.close();
outputStream.close();
} catch (Exception e) { } catch (Exception e) {
log.error("写入文件失败", e); log.error("写入文件失败", e);
throw BusinessExceptionBuilder.build(ResponseCode.FAIL_CODE, e.getMessage()); throw BusinessExceptionBuilder.build(ResponseCode.FAIL_CODE, e.getMessage());
@ -178,7 +180,7 @@ public class FileUtil {
try { try {
out = new FileOutputStream(dstFile); out = new FileOutputStream(dstFile);
CheckedOutputStream cos = new CheckedOutputStream(out, new CRC32()); CheckedOutputStream cos = new CheckedOutputStream(out, new CRC32());
zipOut = new ZipOutputStream(cos); zipOut = new ZipOutputStream(cos, StandardCharsets.UTF_8);
String baseDir = ""; String baseDir = "";
compress(srcFile, zipOut, baseDir); compress(srcFile, zipOut, baseDir);
} catch (IOException e) { } catch (IOException e) {

Loading…
Cancel
Save