Skip to content

Instantly share code, notes, and snippets.

@sur
Created August 29, 2012 14:48
Show Gist options
  • Save sur/3513708 to your computer and use it in GitHub Desktop.
Save sur/3513708 to your computer and use it in GitHub Desktop.
Iconv vs String.encode
# using Iconv
iv = Iconv.new("UTF-8//IGNORE", "UTF-8")
content = iv.iconv(content)
# using String.encode
"string".encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace, :replace => '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment