Skip to content

Instantly share code, notes, and snippets.

@maerzbow
Created July 22, 2012 19:53
Show Gist options
  • Save maerzbow/3160885 to your computer and use it in GitHub Desktop.
Save maerzbow/3160885 to your computer and use it in GitHub Desktop.
ensure_encoding with input encodings given
input.ensure_encoding('UTF-8',
:external_encoding => [::Encoding::UTF_8, ::Encoding::UTF_16LE, ::Encoding::UTF_16BE,
::Encoding::ISO_8859_1],
:invalid_characters => :transcode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment