I’m trying to convert text to big.Float, however, as I understand it, the same string 3000
is represented in different byte forms:
[208 151 48 48 48]
[51 48 48 48]
I tried to look at the utf-8 codes for each version of line 3000
using the utf8.DecodeLastRune
function:
func printUnicode(str string) {
b := []byte(str)
for len(b) > 0 {
r, size := utf8.DecodeLastRune(b)
fmt.Printf("%c %vn", r, size)
b = b[:len(b)-size]
}
}
I got the following result:
З000
0 1
0 1
0 1
З 2
3000
0 1
0 1
0 1
3 1
that is, the string 3000
has a different size of runes
the problem is that when I try to call function big.ParseFloat
for the first version of the string, I get an error:
math/big: cannot unmarshal "З000" into a *big.Float (number has no digits)
what is the reason for this and how to fix it?