mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Fix UTF-8 in upper-case, use ansi charset for all non UTF-8 encodings
This commit is contained in:
		| @@ -55,7 +55,7 @@ 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" { | ||||
| 	if result.Charset != "UTF-8" && len(setting.AnsiCharset) > 0 { | ||||
| 		return setting.AnsiCharset, err | ||||
| 	} | ||||
| 	return result.Charset, err | ||||
| @@ -67,7 +67,7 @@ func ToUtf8WithErr(content []byte) (error, string) { | ||||
| 		return err, "" | ||||
| 	} | ||||
|  | ||||
| 	if charsetLabel == "utf8" { | ||||
| 	if charsetLabel == "UTF-8" { | ||||
| 		return nil, string(content) | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -313,7 +313,7 @@ func NewConfigContext() { | ||||
| 		RepoRootPath = path.Clean(RepoRootPath) | ||||
| 	} | ||||
| 	ScriptType = sec.Key("SCRIPT_TYPE").MustString("bash") | ||||
| 	AnsiCharset = sec.Key("ANSI_CHARSET").MustString("ISO-8859-1") | ||||
| 	AnsiCharset = sec.Key("ANSI_CHARSET").MustString("") | ||||
|  | ||||
| 	// UI settings. | ||||
| 	IssuePagingNum = Cfg.Section("ui").Key("ISSUE_PAGING_NUM").MustInt(10) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user