mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-22 01:34:18 +00:00
#2185 fall back to use custom chardet lib
This commit is contained in:
parent
a62290de52
commit
4993ab1a76
8 changed files with 22 additions and 17 deletions
|
@ -130,8 +130,10 @@ func Sha1(str string) string {
|
|||
}
|
||||
|
||||
func ToUtf8WithErr(content []byte) (error, string) {
|
||||
charsetLabel := base.DetectEncoding(content)
|
||||
if charsetLabel == "utf-8" {
|
||||
charsetLabel, err := base.DetectEncoding(content)
|
||||
if err != nil {
|
||||
return err, ""
|
||||
} else if charsetLabel == "UTF-8" {
|
||||
return nil, string(content)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue