Created
June 19, 2015 11:57
-
-
Save liuxinglanyue/bea1b05934114b048e64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
data := "A\xfe\x02\xff\x04" | |
for _, v := range data { | |
fmt.Printf("%#x ", v) //0x41 0xfffd 0x2 0xfffd 0x4 | |
} | |
fmt.Println() | |
for _, v := range []byte(data) { | |
fmt.Printf("%#x ", v) //0x41 0xfe 0x2 0xff 0x4 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment