Skip to content

Instantly share code, notes, and snippets.

@joepie91
Created January 16, 2017 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joepie91/2d59914167260eb9f2a987cff5fce644 to your computer and use it in GitHub Desktop.
Save joepie91/2d59914167260eb9f2a987cff5fce644 to your computer and use it in GitHub Desktop.
> Array.from("\xff\xaa\x01\x32\x65")
[ 'ÿ', 'ª', '\u0001', '2', 'e' ]
node ~/test-encoding.js | hexdump -C
00000000 c3 bf c2 aa 01 32 65 0a |.....2e.|
00000008
node ~/test-encoding2.js | hexdump -C
00000000 c3 bf c2 aa 01 32 65 0a |.....2e.|
00000008
> Array.from("\xff\xaa\x01\x32\x65").map((char) => char.charCodeAt(0))
[ 255, 170, 1, 50, 101 ]
> Array.from("\xff\xaa\x01\x32\x65").map((char) => char.charCodeAt(0).toString(16))
[ 'ff', 'aa', '1', '32', '65' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment