aboutsummaryrefslogtreecommitdiffstats
path: root/modules/base
diff options
context:
space:
mode:
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/tool.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 9dcbb881d5..75f475fa4f 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -53,7 +53,11 @@ func ShortSha(sha1 string) string {
}
func DetectEncoding(content []byte) string {
- _, name, certain := charset.DetermineEncoding(content, setting.Repository.AnsiCharset)
+ _, name, certain := charset.DetermineEncoding(content, "")
+ if name != "utf-8" && len(setting.Repository.AnsiCharset) > 0 {
+ log.Debug("Using default AnsiCharset: %s", setting.Repository.AnsiCharset)
+ return setting.Repository.AnsiCharset
+ }
log.Debug("Detected encoding: %s (%v)", name, certain)
return name
}