Skip to content

Instantly share code, notes, and snippets.

@AbdallaZaki
Created February 3, 2016 08:47
Show Gist options
  • Save AbdallaZaki/e363ee523f509456eb9c to your computer and use it in GitHub Desktop.
Save AbdallaZaki/e363ee523f509456eb9c to your computer and use it in GitHub Desktop.
fix arabic subtitles
#!bin/bash
dir_name=$1
current_dir=$(pwd)
if [ ! -d $dir_name ];then
echo "not a directory"
exit 1
fi
function change_encoding ()
{
cd $dir_name
files=$( ls ./*.srt )
files_arr=(${files//'\n'/ })
for subtitle_file in "${files_arr[@]}"; do
echo $(iconv -f WINDOWS-1256 -t UTF-8 "$subtitle_file" ) > "$subtitle_file"
done
cd $current_dir
}
change_encoding
echo "covertion completed"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment