|
@@ -12,6 +12,7 @@ import org.springframework.util.Base64Utils;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
|
|
|
/**
|
|
|
* Created by kl on 2018/1/17.
|
|
@@ -36,8 +37,8 @@ public class SimTextFilePreviewImpl implements FilePreview {
|
|
|
try {
|
|
|
File originFile = new File(response.getContent());
|
|
|
String charset = KkFileUtils.getFileEncode(originFile);
|
|
|
- String xmlString = FileUtils.readFileToString(originFile, charset);
|
|
|
- model.addAttribute("textData", Base64Utils.encodeToString(xmlString.getBytes(charset)));
|
|
|
+ String fileData = FileUtils.readFileToString(originFile, charset);
|
|
|
+ model.addAttribute("textData", Base64Utils.encodeToString(fileData.getBytes(StandardCharsets.UTF_8)));
|
|
|
} catch (IOException e) {
|
|
|
return otherFilePreview.notSupportedFile(model, fileAttribute, e.getLocalizedMessage());
|
|
|
}
|