mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Clean code
This commit is contained in:
parent
24250bb359
commit
18ad07d2f4
1 changed files with 2 additions and 2 deletions
|
|
@ -39,13 +39,13 @@ func PinYinCompare(str1, str2 string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// UTF82GBK : transform UTF8 rune into GBK byte array
|
// UTF82GBK transform UTF8 rune into GBK byte array.
|
||||||
func UTF82GBK(src string) ([]byte, error) {
|
func UTF82GBK(src string) ([]byte, error) {
|
||||||
GB18030 := simplifiedchinese.All[0]
|
GB18030 := simplifiedchinese.All[0]
|
||||||
return io.ReadAll(transform.NewReader(bytes.NewReader([]byte(src)), GB18030.NewEncoder()))
|
return io.ReadAll(transform.NewReader(bytes.NewReader([]byte(src)), GB18030.NewEncoder()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GBK2UTF8 : transform GBK byte array into UTF8 string
|
// GBK2UTF8 transform GBK byte array into UTF8 string.
|
||||||
func GBK2UTF8(src []byte) (string, error) {
|
func GBK2UTF8(src []byte) (string, error) {
|
||||||
GB18030 := simplifiedchinese.All[0]
|
GB18030 := simplifiedchinese.All[0]
|
||||||
bytes, err := io.ReadAll(transform.NewReader(bytes.NewReader(src), GB18030.NewDecoder()))
|
bytes, err := io.ReadAll(transform.NewReader(bytes.NewReader(src), GB18030.NewDecoder()))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue