1

I have a list of files that I want to check if they exist with PHP Here is a screenshot of the list (using Options +Indexes)

enter image description here

In PHP, I tried

  • $name = iconv("utf-8", "utf-8//TRANSLIT", $name);
  • file_exists(mb_convert_encoding($name, "UTF-8"));
  • $name = iconv('utf-8', 'cp1252', $name);
  • $name = iconv('UTF-8', 'ISO-8859-1', $name);

None of them works...

By the way, it is a Linux server

EDIT :

I think I found a way to get to the solution. I need to transform the characters like "Sévère" into something like this "Se%CC%81ve%CC%80re%20". How can I do this conversion ?

Kalzem
  • 7,320
  • 6
  • 54
  • 79
  • 1
    That image is huge, can you replace it with a smaller one? – jerry May 22 '13 at 13:55
  • It depends on how your filesystem encodes the names, which depends on your system. What system are we talking about? – deceze May 22 '13 at 13:56
  • possible duplicate http://stackoverflow.com/questions/2685718/special-characters-in-file-exists-problem-php – Valeh Hajiyev May 22 '13 at 13:57
  • See http://stackoverflow.com/questions/1525830/how-do-i-use-filesystem-functions-in-php-using-utf-8-strings - the .pdf filenames appear to be mangled when they have been stored on the windows file system. – Adder May 22 '13 at 13:58
  • @ValehHajiyev : I tried that answer, it doesn't work... – Kalzem May 22 '13 at 14:41

1 Answers1

0

You just need to URL encode the utf-8.

tripleee
  • 175,061
  • 34
  • 275
  • 318