fix: incorrect binary value convert (#279)

This commit is contained in:
Lykin 2024-06-05 10:46:38 +08:00
parent 6eeb701439
commit 88e2c6cb43
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ func (BinaryConvert) Encode(str string) (string, bool) {
func (BinaryConvert) Decode(str string) (string, bool) { func (BinaryConvert) Decode(str string) (string, bool) {
var binary strings.Builder var binary strings.Builder
for _, char := range str { for _, char := range []byte(str) {
binary.WriteString(fmt.Sprintf("%08b", int(char))) binary.WriteString(fmt.Sprintf("%08b", int(char)))
} }
return binary.String(), true return binary.String(), true