Created
September 15, 2015 06:36
-
-
Save markuman/356fb84962eca6898536 to your computer and use it in GitHub Desktop.
converts all ISO-8859 files to UTF-8
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 | |
function convert(){ | |
ENCODING=$(file "$1" |awk '{print$2}') | |
if [[ "$ENCODING" = "ISO-8859" ]]; then | |
iconv -f iso-8859-15 -t utf-8 "$1" > tmp.file | |
mv tmp.file "$1" | |
rm tmp.file | |
fi | |
} | |
export -f convert | |
find . -type f -exec bash -c 'convert $1 "{}"' \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment