to Greek that you can read ... little iconv script -- Windows-1253 -> UTF8

Many text files containing Greek Characters made in Windows systems are encoded with Windows-1253 and end up looking like the following on Linux Systems.

$ cat directions-in-greek.txt
        ������
������������ �� ������ ���� ����� ������ (STORAGE CARD)
������� ���� ��������� -->���������-->



iconv is the easiest way to encode such files to UTF8 eg:
$ iconv -f WINDOWS-1253 -t UTF-8 directions-in-greek.txt
        ΟΔΗΓΙΕΣ
ΑΝΤΙΓΡΑΦΟΥΜΕ ΤΟ ΑΡΧΕΙΟ ΣΤΗΝ ΚΑΡΤΑ ΜΝΗΜΗΣ (STORAGE CARD)
ΚΑΤΟΠΙΝ ΠΑΜΕ ΡΥΘΜΙΣΕΙΣ -->ΕΦΑΡΜΟΓΕΣ-->


However, even when you know about iconv it still gets annoying if you are working with such files a lot. Hence the following little script.

#!/bin/bash
#g0 2013 , http://alog.ipduh.com/2013/03/to-greek-that-you-can-read-little-iconv.html
#convert files in WINDOWS-1253 to UTF8

ICONV="/usr/bin/iconv"
FILE_IN=${1}

if [ $# -eq 1 ]; then

if [ -f ${FILE_IN} ]; then
        ${ICONV} -f WINDOWS-1253 -t UTF-8 ${FILE_IN} -o ${FILE_IN}.utf8
        /bin/cat ${FILE_IN}.utf8
        echo ""
        echo ""
        echo "win2utf8:${FILE_IN} encoded in UTF8 at ${FILE_IN}.utf8"
        exit 0
else
        echo "${FILE_IN} does not exist"
        exit 404
fi

else
        echo "Please enter 1 File name"
        exit 500

fi








     


Install win2utf8
# wget kod.ipduh.com/lib/win2utf8
# mv win2utf8 /usr/bin/
# chmod 755 /usr/bin/win2utf8


Use win2utf8
$ win2utf8 directions-in-greek.txt
        ΟΔΗΓΙΕΣ
ΑΝΤΙΓΡΑΦΟΥΜΕ ΤΟ ΑΡΧΕΙΟ ΣΤΗΝ ΚΑΡΤΑ ΜΝΗΜΗΣ (STORAGE CARD)
ΚΑΤΟΠΙΝ ΠΑΜΕ ΡΥΘΜΙΣΕΙΣ -->ΕΦΑΡΜΟΓΕΣ-->


win2utf8:directions-in-greek.txt encoded in UTF8 at directions-in-greek.txt.utf8






To Greek that you can Read -- iconv script