Created
January 2, 2018 14:25
-
-
Save doyle/45b3d6a0476ad7782b6870485b0d62a5 to your computer and use it in GitHub Desktop.
Converts a csv file in the windows utf 8 encoding to utf 8
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
require 'csv' | |
file = ARGV[0] | |
rows = CSV.read(file, :encoding => 'windows-1251:utf-8') | |
out = CSV.open("#{file.split('.')[0]}_fixed.csv", 'wb') | |
rows.each{|row| out << row} | |
out.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment