mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-02 11:03:23 +09:00
fix: charset lookup (#39187)
This commit is contained in:
@@ -128,41 +128,7 @@ var (
|
||||
TrustedSSHKeys []string `ini:"TRUSTED_SSH_KEYS"`
|
||||
} `ini:"repository.signing"`
|
||||
}{
|
||||
DetectedCharsetsOrder: []string{
|
||||
"UTF-8",
|
||||
"UTF-16BE",
|
||||
"UTF-16LE",
|
||||
"UTF-32BE",
|
||||
"UTF-32LE",
|
||||
"ISO-8859-1",
|
||||
"windows-1252",
|
||||
"ISO-8859-2",
|
||||
"windows-1250",
|
||||
"ISO-8859-5",
|
||||
"ISO-8859-6",
|
||||
"ISO-8859-7",
|
||||
"windows-1253",
|
||||
"ISO-8859-8-I",
|
||||
"windows-1255",
|
||||
"ISO-8859-8",
|
||||
"windows-1251",
|
||||
"windows-1256",
|
||||
"KOI8-R",
|
||||
"ISO-8859-9",
|
||||
"windows-1254",
|
||||
"Shift_JIS",
|
||||
"GB18030",
|
||||
"EUC-JP",
|
||||
"EUC-KR",
|
||||
"Big5",
|
||||
"ISO-2022-JP",
|
||||
"ISO-2022-KR",
|
||||
"ISO-2022-CN",
|
||||
"IBM424_rtl",
|
||||
"IBM424_ltr",
|
||||
"IBM420_rtl",
|
||||
"IBM420_ltr",
|
||||
},
|
||||
DetectedCharsetsOrder: DefaultDetectedCharsetsOrder(),
|
||||
DetectedCharsetScore: map[string]int{},
|
||||
AnsiCharset: "",
|
||||
ForcePrivate: false,
|
||||
@@ -297,6 +263,40 @@ var (
|
||||
ScriptType = "bash"
|
||||
)
|
||||
|
||||
func DefaultDetectedCharsetsOrder() []string {
|
||||
return []string{
|
||||
"UTF-8",
|
||||
"UTF-16BE",
|
||||
"UTF-16LE",
|
||||
"UTF-32BE",
|
||||
"UTF-32LE",
|
||||
"ISO-8859-1",
|
||||
"windows-1252",
|
||||
"ISO-8859-2",
|
||||
"windows-1250",
|
||||
"ISO-8859-5",
|
||||
"ISO-8859-6",
|
||||
"ISO-8859-7",
|
||||
"windows-1253",
|
||||
"ISO-8859-8-I",
|
||||
"windows-1255",
|
||||
"ISO-8859-8",
|
||||
"windows-1251",
|
||||
"windows-1256",
|
||||
"KOI8-R",
|
||||
"ISO-8859-9",
|
||||
"windows-1254",
|
||||
"Shift_JIS",
|
||||
"GB18030",
|
||||
"EUC-JP",
|
||||
"EUC-KR",
|
||||
"Big5",
|
||||
"ISO-2022-JP",
|
||||
"ISO-2022-KR",
|
||||
"ISO-2022-CN",
|
||||
}
|
||||
}
|
||||
|
||||
func loadRepositoryFrom(rootCfg ConfigProvider) {
|
||||
var err error
|
||||
// Determine and create root git repository path.
|
||||
|
||||
@@ -257,5 +257,5 @@ func PanicInDevOrTesting(msg string, a ...any) {
|
||||
if !IsProd || IsInTesting {
|
||||
panic(fmt.Sprintf(msg, a...))
|
||||
}
|
||||
log.Error(msg, a...)
|
||||
log.ErrorWithSkip(1, msg, a...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user