Skip to content

Instantly share code, notes, and snippets.

@romeuhcf
Last active November 14, 2021 00:30
Show Gist options
  • Save romeuhcf/29132ebd3084b14901f8770f3baac3bf to your computer and use it in GitHub Desktop.
Save romeuhcf/29132ebd3084b14901f8770f3baac3bf to your computer and use it in GitHub Desktop.
Ruby 2.5 support for opening csv with bom|utf-8
class CSV
def self.open(file, options={}, &block)
encoding = options.delete(:encoding)
File.open(file, "r:#{encoding}") do |fd|
yield CSV.new(fd, options)
end
end
end
@romeuhcf
Copy link
Author

@lonniev tks buddy. Just updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment