lib/peddler/flat_file_parser.rb in peddler-1.5.0 vs lib/peddler/flat_file_parser.rb in peddler-1.6.0
- old
+ new
@@ -1,12 +1,15 @@
require 'delegate'
require 'csv'
require 'digest/md5'
+require 'peddler/headers'
module Peddler
# @api private
class FlatFileParser < SimpleDelegator
+ include Headers
+
# http://stackoverflow.com/questions/8073920/importing-csv-quoting-error-is-driving-me-nuts
OPTIONS = { col_sep: "\t", quote_char: "\x00", headers: true }.freeze
attr_reader :content, :summary, :encoding
@@ -39,10 +42,10 @@
end
def scrub_content
content
.force_encoding(encoding)
- .encode('UTF-8', undef: :replace, replace: '?')
+ .encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
end
def summary?
body.include?("\n\n")
end