Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # If encoding is not detected assumes Latin 1 (line 22)
- # Here are some alternative encodings:
- # 1250 - Latin 2 / Central European
- # 1251 - Cyrillic
- # 1252 - Latin 1 / Western European
- # 1253 - Greek
- # 1254 - Turkish
- # 1255 - Hebrew
- # 1256 - Arabic
- # 1257 - Baltic
- # 1258 - Vietnamese (also OEM)
- fullPATH=$1
- echo $fullPATH >/tmp/subtitleFIX.log
- encode=`file -ib $fullPATH|cut -d= -f 2`
- echo "encode is : "$encode >>/tmp/subtitleFIX.log
- if [ "$encode" == 'unknown-8bit' ];then
- encode="WINDOWS-1252"
- elif [ "$encode" == "utf-8" ];then
- notify-send Fixed!"
- exit
- fi
- fromFILE=$fullPATH
- fromFILEwithNOextention=`echo $fromFILE|cut -d. -f -1`
- backupFILE=`echo $fromFILEwithNOextention".bak.srt"`
- mv $fromFILE $backupFILE
- iconv $backupFILE -f $encode -t UTF-8 > $fromFILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement