C:\xampp\htdocs\landing\wp-content\plugins\wp-file-manager\lib\php\chars-test.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php

setlocale
(LC_ALL'en_US.UTF-8');

header('Content-Type: text/html; charset=utf-8');
echo 
'белая собака';
echo 
strToLower('белая собака');

$orig 'ёЁйЙØÅŻ';
echo 
$orig '<br>';
$path '../../../files/tmp/';

if (!
touch($path $orig)) {
    exit(
'unable to create file');
}


$orig str_replace('"'''json_encode($orig));
echo 
"original: " $orig '<br>';

$origParts explode('\\'$orig);
array_shift($origParts);

//                     й                 ё              Й               Ё              Ø         Å
$patterns = array("\u0438\u0306""\u0435\u0308""\u0418\u0306""\u0415\u0308""\u00d8A""\u030a");
$replace = array("\u0439""\u0451""\u0419""\u0401""\u00d8""\u00c5");


foreach (
scandir($path) as $f) {
    if (
$f != '.' && $f != '..' && substr($f01) != '.') {

        
// echo mb_detect_encoding($f);

        
$name str_replace('"'''json_encode($f));
        echo 
"before replace: $name<br>";
        
// $name = str_replace($patterns, $replace, $name);
        // echo "after replace: $name<br>";
        
break;
    }
}


$parts explode('\\'$name);
array_shift($parts);


$diff array_diff($parts$origParts);

if (
count($diff)) {
    echo 
"Following symbols not found in original";
    echo 
'<pre>';
    
print_r($diff);
    echo 
'</pre>';
} else {
    echo 
"OK";
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586