Created
October 2, 2012 21:42
-
-
Save michalvalasek/3823495 to your computer and use it in GitHub Desktop.
Converts a text file from windows-1250 encoding to utf-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" == "" ] | |
then | |
echo "usage: $0 <Input file>" | |
exit 0 | |
fi | |
if ! [ -f $1 ] | |
then | |
echo "$1 does not exits" | |
exit 0 | |
fi | |
FROM_ENC=windows-1250 | |
TO_ENC=utf-8 | |
NEW_FILE_NAME=$(sed -E 's#(.txt)#.conv\1#g' <<< $1) | |
iconv -f $FROM_ENC -t $TO_ENC $1 > $NEW_FILE_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment