Roland Tanglao
About

Windows files are UTF-16 NOT UTF8, how to read them in ruby: 'rb:bom|utf-16'

Mar 28, 2018

Pontifications

From read-reviews-replies.rb :

CSV.open(ARGV[0], 'rb:bom|utf-16', :headers => true) do |csv|
  csv.each { |row| ap row }
end

where: rb is read, binary (utf16 files are not text files!)

Leave a comment on github

Roland Tanglao

  • Roland Tanglao
  • roland@rolandtanglao.com
  • rtanglao
  • rtanglao

flickr.com/roland, twitter.com/rtanglao #firefox #thunderbird