Skip to content

Instantly share code, notes, and snippets.

@liuxinglanyue
Created June 19, 2015 11:57
Show Gist options
  • Save liuxinglanyue/bea1b05934114b048e64 to your computer and use it in GitHub Desktop.
Save liuxinglanyue/bea1b05934114b048e64 to your computer and use it in GitHub Desktop.
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