Allow explicit charset/codepage setting for ANSI source files to alleviate issue #1088

This commit is contained in:
Vladimir Vissoultchev committed 2015-07-27 21:58:51 +03:00
1 parent 31f6069dbe
commit 53bcf373c1
2 files changed
+5

No files matched your search

+3
View File
@@ -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
}