Last active
March 9, 2016 11:22
-
-
Save cssence/11d060fb780ad740800d to your computer and use it in GitHub Desktop.
Convert text files 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
#!/usr/bin/env bash | |
if [[ $1 == -f ]]; then | |
format="$2" | |
shift 2 | |
fi | |
for file in $@; do | |
iconv -f ${format-"windows-1252"} -t "UTF-8" "$file" > "${file%.*}.utf8.$(echo $file |awk -F . '{if (NF>1) {print $NF}}')" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment