Use the modules from golang.org/x/text . In your case, it will be something like this:
b := /* Win1256 bytes here. */ dec := charmap.Windows1256.NewDecoder() // Take more space just in case some characters need // more bytes in UTF-8 than in Win1256. bUTF := make([]byte, len(b)*3) n, _, err := dec.Transform(bUTF, b, false) if err != nil { panic(err) } bUTF = bUTF[:n]
Ainar-g
source share