I use the code below generate a XML encoding of string str:
str := string([]byte{0x01})
marshalBytes, _ := xml.Marshal(str)
fmt.Println(string(marshalBytes)) // output: <string>�</string>; � is [239 191 189] in bytes.
Obviously, � is not equivalent of 0x01.
How can I fix it?