Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP file_exists with accent returns false

I have two folders, Folder and Folderé. The second one could not be catch by PHP.

Here is my test:

<?php
        $dir = 'D:\wamp\www\test\data\Folder';
        var_dump(file_exists($dir)); // true

        $dir = 'D:\wamp\www\test\data\Folderé';
        var_dump(file_exists($dir)); // false
?>

How to fix it?

like image 463
Syl Avatar asked Oct 05 '13 17:10

Syl


1 Answers

This works like charm

<?php
$dir = 'D:\wamp\www\test\data\Folderé';
var_dump(file_exists((utf8_decode($dir))));
like image 135
Shankar Narayana Damodaran Avatar answered Oct 06 '22 23:10

Shankar Narayana Damodaran