Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
slm-fileview
Commits
92869e8d
Commit
92869e8d
authored
Dec 28, 2020
by
chenkailing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文本文件编码默认UTF-8输出到页面
parent
c66dda23
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
SimTextFilePreviewImpl.java
...n/java/cn/keking/service/impl/SimTextFilePreviewImpl.java
+3
-2
No files found.
server/src/main/java/cn/keking/service/impl/SimTextFilePreviewImpl.java
View file @
92869e8d
...
@@ -12,6 +12,7 @@ import org.springframework.util.Base64Utils;
...
@@ -12,6 +12,7 @@ import org.springframework.util.Base64Utils;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
/**
/**
* Created by kl on 2018/1/17.
* Created by kl on 2018/1/17.
...
@@ -36,8 +37,8 @@ public class SimTextFilePreviewImpl implements FilePreview {
...
@@ -36,8 +37,8 @@ public class SimTextFilePreviewImpl implements FilePreview {
try
{
try
{
File
originFile
=
new
File
(
response
.
getContent
());
File
originFile
=
new
File
(
response
.
getContent
());
String
charset
=
KkFileUtils
.
getFileEncode
(
originFile
);
String
charset
=
KkFileUtils
.
getFileEncode
(
originFile
);
String
xmlString
=
FileUtils
.
readFileToString
(
originFile
,
charset
);
String
fileData
=
FileUtils
.
readFileToString
(
originFile
,
charset
);
model
.
addAttribute
(
"textData"
,
Base64Utils
.
encodeToString
(
xmlString
.
getBytes
(
charset
)));
model
.
addAttribute
(
"textData"
,
Base64Utils
.
encodeToString
(
fileData
.
getBytes
(
StandardCharsets
.
UTF_8
)));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
otherFilePreview
.
notSupportedFile
(
model
,
fileAttribute
,
e
.
getLocalizedMessage
());
return
otherFilePreview
.
notSupportedFile
(
model
,
fileAttribute
,
e
.
getLocalizedMessage
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment