I am trying to compare two PDF files using UTF-8, but I get the error "Invalid encoding" when I execute the code below:
encoding = 'utf-8'
base_path = set_up
tear_down do
f1 = File.read("#{TMP_DIR}/#{current_file_name}", encoding: encoding)
f2 = File.read("#{base_path}/#{expected_file_name}", encoding: encoding)
expect(f1).to eql f2
end
I tried to use:
f1.force_encoding("UTF-8")
f2.force_encoding("UTF-8")
I tried this too:
f1.force_encoding("BINARY")
but, I get another error:
Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8