Last active
December 10, 2019 15:26
-
-
Save Efrat19/bd0f4fb9cb793abd253ba442313e3eb5 to your computer and use it in GitHub Desktop.
convert dir to utf8
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 | |
#enter input encoding here | |
FROM_ENCODING="WINDOWS-1255" | |
#output encoding(UTF-8) | |
TO_ENCODING="UTF-8" | |
#convert | |
CONVERT=" iconv -f $FROM_ENCODING -t $TO_ENCODING" | |
#loop to convert multiple files | |
for file in $(find $1 -type f -name "*.php"); do | |
$CONVERT "$file" > "${file}.encoded" && mv "${file}.encoded" $file | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment