It seems that file processing in PHP does not work with certain characters (e.g.) encoded with UTF-8 if the path is hard-coded and the php file is saved as UTF-8.
Is it possible to make it work with all (or most western characters)? Is there a library that allows this to be possible? Because I could not find.
For example, a folder with the name äöü&()éèàâêûô@$+ç%&=! £ _; {[]} ~ '¢ ¬§ ° # @ | ... € `in windows will not work with is_dir ().
EDIT: SOLUTION
Ok, I found a solution. I haven't tested it completely yet, I'm not sure if it hasn't passed the test yet, and I don't know if this is the best practice, but encoding the string back to ANSI seems to do the trick (at least for the string I published).
$string = iconv(mb_detect_encoding($string, "auto"), 'Windows-1252', $string);
I think this should work with the default setting for most western Windows computers.
source
share