Feature #1981 » check_for_stray_quotes_19.patch
| lib/csv.rb 2010-03-23 00:00:40.011605472 -0700 | ||
|---|---|---|
|
if part[-1] == @quote_char && part.count(@quote_char) % 2 != 0
|
||
|
# extended column ends
|
||
|
csv.last << part[0..-2]
|
||
|
raise MalformedCSVError if csv.last =~ @parsers[:stray_quote]
|
||
|
csv.last.gsub!(@quote_char * 2, @quote_char)
|
||
|
in_extended_col = false
|
||
|
else
|
||
| ... | ... | |
|
else
|
||
|
# regular quoted column
|
||
|
csv << part[1..-2]
|
||
|
raise MalformedCSVError if csv.last =~ @parsers[:stray_quote]
|
||
|
csv.last.gsub!(@quote_char * 2, @quote_char)
|
||
|
end
|
||
|
elsif part =~ @parsers[:quote_or_nl]
|
||
| ... | ... | |
|
# for detecting parse errors
|
||
|
quote_or_nl: encode_re("[", esc_quote, "\r\n]"),
|
||
|
nl_or_lf: encode_re("[\r\n]"),
|
||
|
stray_quote: encode_re("[^", esc_quote, "]", esc_quote, "[^", esc_quote, "]"),
|
||
|
# safer than chomp!()
|
||
|
line_end: encode_re(esc_row_sep, "\\z"),
|
||
|
# illegal unquoted characters
|
||
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »