Created
August 29, 2012 14:48
-
-
Save sur/3513708 to your computer and use it in GitHub Desktop.
Iconv vs String.encode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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