Last active
September 26, 2018 09:25
-
-
Save zexeder/dd2b3e7ed4bf983fee97d53bb1907087 to your computer and use it in GitHub Desktop.
Recursive file convertion windows-1251 --> 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
# Recursive file convertion windows-1251 --> utf-8 | |
# Place this file in the root of your site, add execute permission and run | |
# Converts *.php, *.html, *.css, *.js files. | |
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command | |
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f | | |
while read file | |
do | |
echo " $file" | |
mv $file $file.icv | |
iconv -f WINDOWS-1251 -t UTF-8 $file.icv > $file | |
# add first line to file | |
# sed -i '1 i<?php include_once $_SERVER["DOCUMENT_ROOT"]."/some_folder/header.php" ?>\n' $file | |
rm -f $file.icv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment