This is a creation in Article, where the information may have evolved or changed.
As you can see from the code below, R is essentially Int32, takes up 4 bytes, the value is 25105;s is a string, takes 3 bytes, and the value is e68891.
The inference R should be Unicode encoded, and S is UTF8 encoded.
Package main Import ( "FMT") func Main () { r: = ' I ' fmt. Printf ("%t\n", R) //%!t (int32=25105) s: = "I" fmt. Printf ("%t,%d%x\n", S, Len (s), s) //%!t (string= me) 3 e68891 FMT. Printf ("%b\n", Int32 (R)) //110001000010001 /0000 0000 0000 0000 0110 0010 0001 0001 for _, B: = range [] Byte (s) { fmt. Printf ("%b\n", b) } //11100110 //10001000 //10010001}
Now print out the binary values for comparison, organized as follows:
0000 0000 0000 0000 0110 0010 0001 0001//R 1110 0110 1001 0001//S
Then convert S to r, i.e. UTF8 to Unicode
1110 0110 1001 0001//s 0110 0001 //s UTF8-Unicode 0000 0000 0110 0010 0001 0 001//s UTF8, unicode0000 0000 0000 0000 0110 0010 0001 0001//R
The conversion succeeds in concluding that R is Unicode encoding s is UTF8 encoded
Golang and Java characters are Unicode encoded strings are UTF8 encoded
Bottom These things must be understood, otherwise it will often harm.