-
-
Save demofly/25f856a96c29b89baa32 to your computer and use it in GitHub Desktop.
A batch script converts (inplaces) all files in a directory 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 | |
apt-get -y install recode uchardet > /dev/null | |
find "$1" -type f | while read FFN # 'dir' should be changed... | |
do | |
encoding=$(uchardet "$FFN") | |
echo "$FFN: $encoding" | |
enc=`echo $encoding | sed 's#^x-mac-#mac#'` | |
set +x | |
recode $enc..UTF-8 "$FFN" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment