I'm trying to rename a file,
That file generated by unizp a zip file, but the file have a strange character
Lieferungen und R�cklieferungen_RvP_2019_02_04.csv
we can't have control over that character becoz we getting zip file from 3rd party.
that symbol is ü but when unzip using php code it shows that strange symbol.
I tried using this code
$files = glob("/xxxxmyfullpath/unzipped/*.csv");
echo $numfiles = count($files);
if ($numfiles == 1) {
// Rename it
echo $files[0];
rename($files[0], "testing.csv");
}
but the glob doesn't seems identify the file.
anyone know how to remove that unrecognized symbol from file name please
Filename is coded probably Windows-1252, Western-Europe, but your terminal probably uses UTF-8. � = ü = ü Latin small letter u with diaeresis. If your $numfiles is greater than 1, your rename code won't run at all. If the name of your extracted file contains illegal characters, it won't "glob" at all. Before you unzip your archive, you have to switch to a legacy codepage. Try: setlocale(LC_ALL, 'C'); and then, try to run your code.