I think the ideal solution for me is a Nautilus Script that performs encoding conversion on selected files.
The following script reads the encoding of a selected file and performs utf8 conversion if it's not utf8, but I couldn't figure out how to make it work on multiple files:
CHARSET="$(file -bi "$1"|awk -F "=" '{print $2}')"
if [ "$CHARSET" != utf-8 ]; then
iconv -f "$CHARSET" -t utf8 "$1" -c -o "$1.utf8"
fi
Let's say your script is named
convert-to-utf-8.sh
. Here's how you would make it work across multiple files:You could incorporate that for-loop in the script itself, like this:
You could then run the script with multiple filenames like this:
Here's a nice and simple Nautilus Script that I've managed to write thanks to Flimm as seen in the answer above: