from
http://linsovet.com
if [ -z "$1" ]; then
echo Variants list of cyrillic reencoding 1>&2
echo Usage: $(basename $0) cyrillic string 1>&2
exit 1
fi
TEXT="$*"
ENC="cp1251 koi8-r utf-8 cp866"
CMD='iconv -cf $i1 -t $i2 | iconv -cf $i3 -t $i4'
for i1 in $ENC; do
for i2 in $ENC; do
for i3 in $ENC; do
for i4 in $ENC; do
[ "$i1" == "$i2" -o "$i4" == "$i3" ] && continue
[ "$i1" == "$i4" -a "$i2" == "$i3" ] && continue
printf "%-60s%s\n" "$(eval echo \"$CMD\")" "$(echo "$TEXT" | eval "$CMD")"
done
done
done
done | sort -bk 12