app/importers/data_transformers/parseable_csv_string.rb
# Find newlines within quotes fields `\CRLF` and replace them with spaces, since
# the Ruby CSV class can't understand that they're within the field and interpret them as a
# broken line that hasn't closed the quote.
# Don't get confused by escape characters before.
Find newlines within quotes fields `\CRLF` and replace them with spaces, since
the Ruby CSV class can't understand that they're within the field and interpret them as a
broken line that hasn't closed the quote.
Don't get confused by escape characters before.
Find newlines within quotes fields ` \ CRLF ` and replace them with spaces since the Ruby CSV class can ' t understand that they ' re within the field and interpret them as a broken line that hasn ' t closed the quote . Don ' t get confused by escape characters before .
def strip_inline_newlines(string)
    @log.puts '#strip_inline_newlines...'
    newlines_stripped_count = 0
    string_without_inline_newlines = string.gsub(/(?<!\\)\\\r\n/) do
      newlines_stripped_count = newlines_stripped_count + 1
      ' '
    end
    @log.puts "  stripped #{newlines_stripped_count} newlines."
    string_without_inline_newlines
  end
def strip_inline_newlines ( string ) @log . puts '#strip_inline_newlines...' newlines_stripped_count = 0 string_without_inline_newlines = string . gsub ( / (?<! \\ ) \\ \r \n / ) do newlines_stripped_count = newlines_stripped_count + 1 ' ' end @log . puts "  stripped #{newlines_stripped_count} newlines." string_without_inline_newlines end
Find newlines within quotes fields `\CRLF` and replace them with spaces, since
the Ruby CSV class can't understand that they're within the field and interpret them as a
broken line that hasn't closed the quote.
Find newlines within quotes fields ` \ CRLF ` and replace them with spaces since the Ruby CSV class can ' t understand that they ' re within the field and interpret them as a broken line that hasn ' t closed the quote .
string
<not_specific>