mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
Allow explicit charset/codepage setting for ANSI source files to alleviate issue #1088
This commit is contained in:
@ -55,6 +55,9 @@ func ShortSha(sha1 string) string {
|
||||
func DetectEncoding(content []byte) (string, error) {
|
||||
detector := chardet.NewTextDetector()
|
||||
result, err := detector.DetectBest(content)
|
||||
if result.Charset == "ISO-8859-1" {
|
||||
return setting.AnsiCharset, err
|
||||
}
|
||||
return result.Charset, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user