Skip to content

Instantly share code, notes, and snippets.

@0xradical
Last active December 14, 2015 17:09
Show Gist options
  • Select an option

  • Save 0xradical/5120313 to your computer and use it in GitHub Desktop.

Select an option

Save 0xradical/5120313 to your computer and use it in GitHub Desktop.
Test string against every encoding present in Encoding.aliases.values
test_string = 'Informação'
Encoding.aliases.values.uniq.each do |encoding|
begin
puts "In #{encoding}: #{test_string.clone.force_encoding(encoding)}"
rescue
puts "Barfed for #{encoding}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment