Created
December 3, 2008 05:54
-
-
Save soawesomeman/31433 to your computer and use it in GitHub Desktop.
This file contains 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
# forgot where I got this, thanks dude! | |
class String | |
def to_ascii_iconv | |
converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') | |
converter.iconv(self).unpack('U*').select{ |cp| cp < 127 }.pack('U*') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment