lib/peddler/flat_file_parser.rb in peddler-1.6.3 vs lib/peddler/flat_file_parser.rb in peddler-1.6.4

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'delegate' require 'csv' require 'digest/md5' require 'peddler/headers' @@ -32,10 +34,11 @@ end private def scrub_body!(encoding) - body.force_encoding(encoding) unless body.encoding == Encoding::UTF_8 + return if body.encoding == Encoding::UTF_8 + self.body = body.dup.force_encoding(encoding) end def extract_content_and_summary @content = body.encode('UTF-8', invalid: :replace, undef: :replace) @summary, @content = @content.split("\n\n") if @content.include?("\n\n")