Bug #8585 ยป bug-8585.diff
lib/csv.rb | ||
---|---|---|
@force_quotes = options.delete(:force_quotes)
|
||
do_quote = lambda do |field|
|
||
field = String(field)
|
||
encoded_quote = @quote_char.encode(field.encoding)
|
||
encoded_quote +
|
||
field.gsub(encoded_quote, encoded_quote * 2) +
|
||
encoded_quote
|
||
field_encoding = field.encoding
|
||
if field_encoding.ascii_compatible?
|
||
encoded_quote = @quote_char
|
||
else
|
||
encoded_quote = @quote_char.encode(field_encoding)
|
||
end
|
||
"#{encoded_quote}#{field.gsub(encoded_quote, '\&\&')}#{encoded_quote}"
|
||
end
|
||
quotable_chars = encode_str("\r\n", @col_sep, @quote_char)
|
||
@quote = if @force_quotes
|