I’m building a program that takes two files and after some processing, I have to compare some sections of the files.
As an example, When I print both strings I’m trying to compare, it looks like this:
CSV = 'UC013. MANTER ITEM DE NOTA FISCAL / NOTA DE SERVI\xc3\x87O / RECIBO'
DOC = 'UC013. MANTER ITEM DE NOTA FISCAL / NOTA DE SERVI\xc7O / RECIBO'
Both should be the same:
'UC013. MANTER ITEM DE NOTA FISCAL / NOTA DE SERVIÇO / RECIBO'
How can I print the right characters in the console and properly compare the strings?
Thanks a lot for your help.
You have two files with different encodings, the first is utf-8 (
CSV), the second latin1 (DOC). If you want to compare them, you have to decode them to unicode first: