I am trying to convert string PyrÉnÉes
to Pyrenees
in Go but I am getting Pyr�n�es
as output.
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
s := "PyrÉnÉes"
t := make([]byte, utf8.RuneCountInString(s))
i := 0
for _, r := range s {
t[i] = byte(r)
i++
}
fmt.Print(string(t))
}
Can someone advise what wrong I am doing ?