How is this bit representation above 128?


(Dean Glueckler) #1

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?


(Norbert Melzer) #2

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