Skip to content

Instantly share code, notes, and snippets.

/foo.rb Secret

Created March 31, 2016 20:29
Show Gist options
  • Save anonymous/1199866ce36dbc4185c74715a80318fe to your computer and use it in GitHub Desktop.
Save anonymous/1199866ce36dbc4185c74715a80318fe to your computer and use it in GitHub Desktop.
2.2.1 :072 > "\xE0\xA4\xB8".force_encoding('ASCII-8BIT').force_encoding('UTF-8').valid_encoding?
=> true
2.2.1 :073 > "\xE0\xA4\xB8".force_encoding('ASCII-8BIT').to_json
Encoding::UndefinedConversionError: "\xE0" from ASCII-8BIT to UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment