Skip to content

Instantly share code, notes, and snippets.

@nmelihsensoy
Created August 31, 2018 08:43
Show Gist options
  • Select an option

  • Save nmelihsensoy/80c1bc5377c76e481018b0d1927d20a3 to your computer and use it in GitHub Desktop.

Select an option

Save nmelihsensoy/80c1bc5377c76e481018b0d1927d20a3 to your computer and use it in GitHub Desktop.
Converting Turkish subtitles to UTF-8 Linux Bash Script
#!/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