Created
December 18, 2013 03:47
-
-
Save agarie/8016988 to your computer and use it in GitHub Desktop.
Fixes issues when dealing with ISO-8859-1 ("LATIN-1") encoded files, which are very common with government data and such.
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
def fix_encoding(fn) | |
q = File.read(fn) | |
File.open(fn, 'w') { |f| f << q.encode("UTF-8", "ISO-8859-1") } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment