mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-31 21:00:02 +02:00
#2185 use Go sub-repo to detect encoding
This commit is contained in:
parent
79dcd7ee6e
commit
95f9c85bcc
7 changed files with 11 additions and 21 deletions
|
@ -127,11 +127,7 @@ func Sha1(str string) string {
|
|||
}
|
||||
|
||||
func ToUtf8WithErr(content []byte) (error, string) {
|
||||
charsetLabel, err := base.DetectEncoding(content)
|
||||
if err != nil {
|
||||
return err, ""
|
||||
}
|
||||
|
||||
charsetLabel := base.DetectEncoding(content)
|
||||
if charsetLabel == "UTF-8" {
|
||||
return nil, string(content)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue