#!/bin/sh
read -p 'expected keyword: ' expected

for i in $(iconv -l); do
    iconv -f $i -t UTF-8 "$1" > /tmp/brute_iconv 2> /dev/null

    if grep "$expected" /tmp/brute_iconv > /dev/null; then
        cat /tmp/brute_iconv
        printf "\nOK ? [y/N]\n"
        read confirmation
        [ "$confirmation" = 'y' ] && mv /tmp/brute_iconv "$2" && exit
    fi
done
