1
0
mirror of https://github.com/fumiama/emozi.git synced 2026-06-11 21:50:35 +08:00

fix(校验): RTL 不可见字符引起的显示问题

This commit is contained in:
源文雨
2024-02-15 21:38:25 +09:00
parent 7c296fa9b7
commit 3adb6a8f0f
5 changed files with 35 additions and 30 deletions

View File

@@ -210,14 +210,14 @@ var 逆声调 = 逆初始化[声调枚举](声调[:], 4)
//
// 具体做法是先对后面的文本做crc32然后取 校验表长度^校验字节数 的模
var 校验表 = func() []rune {
x, err := base14.UTF16BE2UTF8(base14.StringToBytes("\x20\x0b\x20\x0c\x20\x0d\x20\x0e\x20\x0f\x20\x2a\x20\x2b\x20\x2c\x20\x2d\x20\x2e\x20\x60\x20\x61\x20\x62\x20\x63\x20\x64\x20\x65\x20\x66\x20\x68\x20\x69\x20\x6a\x20\x6b\x20\x6c\x20\x6d\x20\x6e\x20\x6f"))
x, err := base14.UTF16BE2UTF8(base14.StringToBytes("\x20\x0b\x20\x0c\x20\x0d\x20\x0e\x20\x2a\x20\x2c\x20\x2d\x20\x60\x20\x61\x20\x62\x20\x63\x20\x64\x20\x65\x20\x66\x20\x68\x20\x69\x20\x6a\x20\x6b\x20\x6c\x20\x6d\x20\x6e\x20\x6f"))
if err != nil {
panic(err)
}
return []rune(base14.BytesToString(x))
}()
// 校验表长度 25
// 校验表长度 22
var 校验表长度 = len(校验表)
// 校验字节数 默认为 3, 不得大于 3