#!/bin/sh

set -e

at_exit() {
    echo "info: test exiting"
}
trap at_exit INT TERM EXIT

cd "$AUTOPKGTEST_TMP"
set -x
TMPFILE=testfile.txt

echo "Test file with UTF-8 and ISO-8859-1" > "$TMPFILE"
echo The special Norwegian characters are æ, ø and å >> "$TMPFILE"
echo The special Norwegian characters are æ, ø and å | iconv -f UTF-8 -t ISO-8859-1 >> "$TMPFILE"

if mixconv -d "$TMPFILE" | iconv -f UTF-8 -t ASCII//TRANSLIT; then
    echo "success: entire file is UTF-8."
else
    echo "failure: entire file is not UTF-8."
fi

rm "$TMPFILE"
