I need to convert strings to byte slices, I use the function []byte(string)
, but when the string has the letter ñ or some letter with an accent I get a different value than expected.
fmt.Println([]byte("áéíóúñÁÉÍÓÚÑ"))
Expected result: [ 160 130 161 162 163 181 144 214 224 233 ]
Obtained result: [195 161 195 169 195 173 195 179 195 186 195 177 195 129 195 137 195 141 195 147 195 154 195 145]
So when I convert to string the obtained value I get ├í├®├¡├│├║├▒├ü├ë├ì├ô├Ü├æ
instead of áéíóúñÁÉÍÓÚÑ
How can I get the right values?