Created
July 31, 2014 05:50
-
-
Save bato3/bff87a3c7c173168fa03 to your computer and use it in GitHub Desktop.
UTF-8Y fixer
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
<pre><?php | |
set_time_limit(3600); | |
ini_set('max_execution_time',3600); | |
$dirs = Array(); | |
$files = array(); | |
function fixUTF8($dir) | |
{ | |
if ($handle = opendir($dir)) { | |
while (false !== ($file = readdir($handle))) { | |
if($file != "." && $file != "..") { | |
if(is_dir($dir.'\\'.$file)){ | |
fixUTF8($dir.'\\'.$file); | |
}else{ | |
$x = file_get_contents($dir.'/'.$file); | |
print 'fix:' .$dir.'/'.$file . ': '; | |
if(substr($x,0,3) == ''){ | |
file_put_contents($dir.'/'.$file, substr($x,3)); | |
print "DONE\n"; | |
} | |
else | |
print "NOT NEED\n"; | |
} | |
} | |
} | |
closedir($handle); | |
//die(); | |
} | |
} | |
fixUTF8('.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment