lib/eco/api/common/people/entry_factory.rb in eco-helpers-2.3.2 vs lib/eco/api/common/people/entry_factory.rb in eco-helpers-2.3.3

- old
+ new

@@ -193,16 +193,16 @@ logger.error("File does not exist: #{file}") exit(1) end ext = File.extname(file) encoding ||= Eco::API::Common::Session::FileManager.encoding(file) - encoding = (encoding != "utf-8")? "#{encoding}|utf-8": encoding read_with_tolerance(file, encoding: encoding) end def read_with_tolerance(file, encoding:) if content = File.read(file, encoding: encoding) + content = content.encode("utf-8") tolerance = 5 content.scrub do |bytes| replacement = '<' + bytes.unpack('H*')[0] + '>' if tolerance <= 0 logger.error("There were more than 5 encoding errors in the file '#{file}'.") @@ -218,12 +218,10 @@ def fatal(msg) logger.fatal(msg) raise msg end - end - end end end end