fix(validator): exclude the correct GBK trail byte (#372)

This commit is contained in:
Yusuf Efe authored and GitHub committed 2026-10-23 20:54:08 +08:00
1 parent 65806afc7d
commit 129da3f2ed
2 files changed
+4 -1

No files matched your search

+3
View File
@@ -811,6 +811,9 @@ func TestIsGBK(t *testing.T) {
t.Parallel()
assert := internal.NewAssert(t, "TestIsGBK")
if !IsGBK([]byte{0x81, 0xf7}) || IsGBK([]byte{0x81, 0x7f}) {
t.Error("GBK trails must allow 0xf7 and reject 0x7f")
}
str := "你好"
gbkData, _ := simplifiedchinese.GBK.NewEncoder().Bytes([]byte(str))