I have an example filename: $filename = "./music/Daddy Yankee - ¿Qué Tengo Que Hacer.mp3"
When attempting to run if (file_exists($filePathAudio)) { }
returns file not found
Have confirmed that all other characters in string work properly except for this inverted question mark. How can I get the inverted mark to work, perhaps by some encoding % value?
The string for $filename is displayed by echo or log as the correct path, including all correctly named characters, but is thrown off by the mark.
CodePudding user response:
Probably is the encoding per se. Try to use this sentence:
file_exists(mb_convert_encoding($filename, "UTF-8"));
Another option:
file_exists(iconv('utf-8', 'cp1252', $filename))