func main() {
fmt.Println([]byte(“世界”))
}
// outputs: [228 184 150 231 149 140]
Can someone explain what’s going on here… I thought each value would be a bit that can only be up to 128?
func main() {
fmt.Println([]byte(“世界”))
}
// outputs: [228 184 150 231 149 140]
Can someone explain what’s going on here… I thought each value would be a bit that can only be up to 128?
Each value is a byte, bytes can be from 0 to 255.
More about how everything is encoded can be read on wikipedia, https://en.wikipedia.org/wiki/UTF-8
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.