Bug #12373 » csv-shift-1.patch
lib/csv.rb | ||
---|---|---|
parts.each do |part|
|
||
if in_extended_col
|
||
# If we are continuing a previous column
|
||
if part[-1] == @quote_char && part.count(@quote_char) % 2 != 0
|
||
if part.end_with?(@quote_char) && part.count(@quote_char) % 2 != 0
|
||
# extended column ends
|
||
csv.last << part[0..-2]
|
||
if csv.last =~ @parsers[:stray_quote]
|
||
... | ... | |
csv.last << part
|
||
csv.last << @col_sep
|
||
end
|
||
elsif part[0] == @quote_char
|
||
elsif part.start_with?(@quote_char)
|
||
# If we are starting a new quoted column
|
||
if part.count(@quote_char) % 2 != 0
|
||
# start an extended column
|
||
csv << part[1..-1]
|
||
csv.last << @col_sep
|
||
in_extended_col = true
|
||
elsif part[-1] == @quote_char
|
||
elsif part.end_with?(@quote_char)
|
||
# regular quoted column
|
||
csv << part[1..-2]
|
||
if csv.last =~ @parsers[:stray_quote]
|