mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
* lib/csv.rb (CSV.foreach): 'rb' mode is defaulted in open.
* lib/csv.rb (CSV#init_separators): cannonicalize encoding options as Encoding objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9ff4e23741
commit
08d99ac9e3
3 changed files with 36 additions and 7 deletions
|
@ -260,6 +260,23 @@ class TestCSV::Encodings < TestCSV
|
|||
end unless encoding == __ENCODING__
|
||||
rescue Encoding::ConverterNotFoundError
|
||||
end
|
||||
options[:encoding] = encoding.name
|
||||
CSV.open(@temp_csv_path, options) do |csv|
|
||||
csv.each_with_index do |row, i|
|
||||
assert_equal(fields[i], row)
|
||||
end
|
||||
end
|
||||
options.delete(:encoding)
|
||||
options[:external_encoding] = encoding.name
|
||||
options[:internal_encoding] = __ENCODING__.name
|
||||
begin
|
||||
CSV.open(@temp_csv_path, options) do |csv|
|
||||
csv.each_with_index do |row, i|
|
||||
assert_equal(orig_fields[i], row)
|
||||
end
|
||||
end unless encoding == __ENCODING__
|
||||
rescue Encoding::ConverterNotFoundError
|
||||
end
|
||||
end
|
||||
|
||||
def encode_ary(ary, encoding)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue