Skip to content

Commit fb0705b

Browse files
committed
add error log for unsupported charset
1 parent 5a520d5 commit fb0705b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/charset/charset.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"unicode/utf8"
1111

12+
"code.gitea.io/gitea/modules/log"
1213
"code.gitea.io/gitea/modules/setting"
1314
"code.gitea.io/gitea/modules/util"
1415

@@ -74,7 +75,8 @@ func ToUTF8(content []byte, opts ConvertOpts) []byte {
7475

7576
encoding, _ := charset.Lookup(charsetLabel)
7677
if encoding == nil {
77-
setting.PanicInDevOrTesting("unknown detected charset %q, it shouldn't happen", charsetLabel)
78+
log.Error("Unsupported detected charset %q, please check your charset setting in your config, or report an issue", charsetLabel)
79+
setting.PanicInDevOrTesting("unsupported detected charset %q, it shouldn't happen", charsetLabel)
7880
return content
7981
}
8082

0 commit comments

Comments
 (0)