26 lines
656 B
Go
26 lines
656 B
Go
package main
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/hex"
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"golang.org/x/text/encoding/japanese"
|
||
|
|
unicodex "golang.org/x/text/encoding/unicode"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestEncoding(t *testing.T) {
|
||
|
|
bb := []byte{130, 80, 130, 81, 130, 82, 130, 83, 130, 84, 130, 85, 130, 86, 130, 87}
|
||
|
|
re, _ := japanese.ShiftJIS.NewDecoder().Bytes(bb)
|
||
|
|
res := strings.ToLowerSpecial(numConv, string(re))
|
||
|
|
t.Logf("%s", res)
|
||
|
|
}
|
||
|
|
func TestEncoding1(t *testing.T) {
|
||
|
|
bb, _ := hex.DecodeString("FF11FF12FF13FF14FF15FF16FF17FF18")
|
||
|
|
re, _ := unicodex.UTF16(unicodex.BigEndian, unicodex.IgnoreBOM).NewDecoder().Bytes(bb)
|
||
|
|
|
||
|
|
res := strings.ToLowerSpecial(numConv, string(re))
|
||
|
|
|
||
|
|
t.Logf("%s", res)
|
||
|
|
}
|