Whats the equivalent of C#'s Encoding.UTF8.GetString in Go?
As i already know that Go's default encoding is in UTF8 and string(somebytes) in Go would produce a UTF8 encoded string.
C#:
public static void Main()
{
byte[] bytes = new byte[] { 144, 197, 217, 192, 204, 249, 181, 42, 92, 252, 243, 87, 170, 243, 169, 80, 175, 112, 192, 239};
string str = Encoding.UTF8.GetString(bytes);
Console.WriteLine(str);
}
Go:
func main() {
bytes := []byte { 144, 197, 217, 192, 204, 249, 181, 42, 92, 252, 243, 87, 170, 243, 169, 80, 175, 112, 192, 239}
str := string(bytes)
fmt.Println(str)
}
C# code produces:
�������*\��W��P�p��
Go code produces:
�������*\��W���P�p��
what I am missing here?