mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-13 01:56:22 +08:00
fix: File content support GBK encoding (#9198)
This commit is contained in:
parent
0c64c8ff52
commit
bb99853000
1 changed files with 1 additions and 1 deletions
|
@ -337,7 +337,7 @@ func (f *FileService) GetContent(op request.FileContentReq) (response.FileInfo,
|
|||
}
|
||||
if !utf8.Valid(content) {
|
||||
_, decodeName, _ := charset.DetermineEncoding(content, "")
|
||||
if decodeName == "windows-1252" {
|
||||
if decodeName == "windows-1252" || strings.ToLower(decodeName) == "gbk" {
|
||||
reader := strings.NewReader(info.Content)
|
||||
item := transform.NewReader(reader, simplifiedchinese.GBK.NewDecoder())
|
||||
contents, err := io.ReadAll(item)
|
||||
|
|
Loading…
Add table
Reference in a new issue