This bash script uses the file utility to guess the text encoding of a file. If it is ISO-8859-* or UTF-8, then the file is transformed to Mac-Roman encoding, otherwise the file is not transformed:
#!/bin/bash charset=`file -I "$1" | sed "s/^.*charset=//"` case $charset in iso-8859* | utf-8 ) iconv -c -f $charset -t MacRoman "$1" ;; * ) cat "$1" ;; esacCreate a file (e.g., convert_text_to_macroman.sh) and put it somewhere (e.g., in ~/bin). Make the script executable:
$ chmod a+x ~/bin/convert_text_to_macroman.shNow start FileMerge and go to the Preferences. Select the Filter tab and click in an empty row to start a new filter. Type txt in the Extension column, and put the following in the Filter column:
~/bin/convert_text_to_macroman.sh $(FILE)Now you can try to compare two files in Latin-1 or UTF-8 encoding using FileMerge. If you want to use the filter for several different extensions, I guess you have to create one row for each extension.

