Skip to content

Instantly share code, notes, and snippets.

@labocho
Created March 23, 2012 04:42
Show Gist options
  • Save labocho/2166865 to your computer and use it in GitHub Desktop.
Save labocho/2166865 to your computer and use it in GitHub Desktop.
CSV を文字コード変換しつつロード ref: http://qiita.com/items/8559576b71642b79df67
CSV.foreach(filename, encoding: "Shift_JIS:UTF-8") do |row|
# …
end
open(filename, "rb:Shift_JIS:UTF-8", undef: :replace) do |f|
# …
end
open(filename, "rb:Shift_JIS:UTF-8", undef: :replace) do |f|
CSV.new(f).each do |row|
# ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment