-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert.php
More file actions
19 lines (19 loc) · 747 Bytes
/
convert.php
File metadata and controls
19 lines (19 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function encodeFiles($rootPath)
{
$directories = scandir($rootPath);
// Loop through each directory in the rootPath
foreach ($directories as $dir)
{
if (file_exists($fileName))
{
// Read in the contents
$data = file_get_contents($fileName);
// Just display on the screen the file being modified
echo "Converting " . $fileName . "...\n";
// Convert the contents
$data = iconv("UCS-2","UTF-8", $data);
// Write back out to the same file
file_put_contents($fileName,$data);
} // end if file exists
} // end loop for each directory in the root directory
} // end of function encodeFiles()