RsD0p9BK
1/29/2014 - 6:53 AM

Create 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

Create 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.sh

Now 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)

http://hints.macworld.com/article.php?story=20091116060951378

#!/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"
  ;;
esac