Created
August 31, 2018 08:43
-
-
Save nmelihsensoy/80c1bc5377c76e481018b0d1927d20a3 to your computer and use it in GitHub Desktop.
Converting Turkish subtitles to UTF-8 Linux Bash Script
This file contains hidden or 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 | |
| #Convert Turkish subtitles to UTF-8 | |
| # | |
| for file in *.srt | |
| do | |
| if [ ! -f $file ]; then | |
| echo "Altyazı dosyası bulunamadı. :(" | |
| else | |
| charset="$( file -bi "$file"|awk -F "=" '{print $2}')" | |
| if [ "$charset" != utf-8 ]; then | |
| iconv -f ISO-8859-9 -t UTF-8 "$file" >"$file.new" && | |
| mv -f "$file.new" "$file" && | |
| echo "$file" | |
| fi | |
| fi | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment