WinMerge: How to compare files with the same content but different encodings?

Just for your information. The question was for the latest stable 2.12.4. I have tried the beta version 2.13.22, and it works just perfectly for me. See the difference for exactly the same files -- only the first lines in the files were removed. (My big thanks to authors.)

enter image description here


This doesn't really answer your question about WinMerge, but have you considered using another diff program? One of my favorites is kdiff - http://kdiff3.sourceforge.net/

When I do a compare on KDiff using one UTF8 file and another Unicode file, I get the following:KDiff Compare Warning

Here is the compare screen - note that the encodings on the files are different, but the files are considered to be equal from a text standpoint:

KDiff Compare Results


  1. Edit -> Options
  2. Select 'Compare' from categories pane on left.
  3. Check box 'Ignore carriage return differences' (UNIX, Windows, Mac)

I think it really should not be the task of a merge tool to allow the merging of files stored in different encodings.

An encoding is a function that maps bytes (stored on the disk or in memory) to characters (displayed on screen). Unfortunately, by default the encoding of a file is not stored together with the file. Therefore, any program that wants to open the file and display its contents needs to guess the encoding. While this sometimes works, it is also an error prone procedure.

Now, the character sets of different encodings do not overlap in general. So what is the merge tool supposed to do if you merge a character C from file A in encoding X into a file B in encoding Y, if character C is not part of the character set of encoding Y?

Thus, I think the task of a merge tool should be to merge the binary content. Anything else is a dirty hack and damned to fail at some level. (A merge tool maker may decide to provide character level merging, which also might work most of the time. But there is some guesswork involved.)

Therefore, I'd also recommend you first translate the old files to UTF-8 and then merge those with the new versions.

Tags:

Winmerge