mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	#2282 fix utf-8 recognized as windows-1252
This commit is contained in:
		@@ -25,6 +25,7 @@ import (
 | 
			
		||||
	"golang.org/x/net/html/charset"
 | 
			
		||||
 | 
			
		||||
	"github.com/gogits/gogs/modules/avatar"
 | 
			
		||||
	"github.com/gogits/gogs/modules/log"
 | 
			
		||||
	"github.com/gogits/gogs/modules/setting"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -52,7 +53,8 @@ func ShortSha(sha1 string) string {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func DetectEncoding(content []byte) string {
 | 
			
		||||
	_, name, _ := charset.DetermineEncoding(content, setting.Repository.AnsiCharset)
 | 
			
		||||
	_, name, certain := charset.DetermineEncoding(content, setting.Repository.AnsiCharset)
 | 
			
		||||
	log.Debug("Detected encoding: %s (%v)", name, certain)
 | 
			
		||||
	return name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user