Skip to content

Instantly share code, notes, and snippets.

/foo.rb Secret

Created March 31, 2016 21:36
Show Gist options
  • Save anonymous/edacfafeb6d73573d951b28a2551d2c9 to your computer and use it in GitHub Desktop.
Save anonymous/edacfafeb6d73573d951b28a2551d2c9 to your computer and use it in GitHub Desktop.
# This is the original code, but I don't know what 'input' was
j = JSON.parse(input)
y = j.to_yaml
d = YAML.load(y)
d.to_json
# => Encoding::UndefinedConversionError: "\xE0" from ASCII-8BIT to UTF-8
# I don't know what 'input' was, but 'y' is:
y = "\xE0\xA4\xB8".force_encoding('ASCII-8BIT').to_yaml
d = YAML.load(y)
d.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