Skip to content

Instantly share code, notes, and snippets.

@cho45
Created January 17, 2016 07:52
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 cho45/737d04526ab3fd8e3c05 to your computer and use it in GitHub Desktop.
Save cho45/737d04526ab3fd8e3c05 to your computer and use it in GitHub Desktop.
#!ruby -v
string = "\xA9foobar".force_encoding("ASCII-8BIT")
p string.unpack("C*") == "\xA9foobar".unpack("C*")
#=> true
p string == "\xA9foobar"
#=> false (depends on magic comment, default literal is UTF-8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment