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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
--TEST--
Thai cp874 basic test
--SKIPIF--
<?php
include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc";
skip_if_not_win();
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts();
skip_if_wrong_cp(874, "oem");
?>
--INI--
default_charset=cp874
--FILE--
<?php
/*
#vim: set fileencoding=cp874
#vim: set encoding=cp874
*/
include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util.inc";
$names = array( /* cp874 */
"เป็นแฟ้มที่ทดสอบ1",
"เป็นแฟ้มที่ทดสอบ2",
"เป็นแฟ้มที่ทดสอบ3",
"เป็นแฟ้มที่ทดสอบ4",
"เป็นแฟ้มที่ทดสอบ5",
"เป็นแฟ้มที่ทดสอบ6",
"เป็นแฟ้มที่ทดสอบ7",
"เป็นแฟ้มที่ทดสอบ8",
"เป็นแฟ้มที่ทดสอบ8 10",
);
$i = 0;
foreach ($names as $name) {
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $name . ".txt";
file_put_contents($path, "hello" . $i++);
get_basename_with_cp($path, 874);
var_dump(file_get_contents($path));
unlink($path);
}
?>
===DONE===
--EXPECTF--
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ1.txt
string(%d) "เป็นแฟ้มที่ทดสอบ1.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ1.txt"
Active code page: %d
string(6) "hello0"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ2.txt
string(%d) "เป็นแฟ้มที่ทดสอบ2.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ2.txt"
Active code page: %d
string(6) "hello1"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ3.txt
string(%d) "เป็นแฟ้มที่ทดสอบ3.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ3.txt"
Active code page: %d
string(6) "hello2"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ4.txt
string(%d) "เป็นแฟ้มที่ทดสอบ4.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ4.txt"
Active code page: %d
string(6) "hello3"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ5.txt
string(%d) "เป็นแฟ้มที่ทดสอบ5.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ5.txt"
Active code page: %d
string(6) "hello4"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ6.txt
string(%d) "เป็นแฟ้มที่ทดสอบ6.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ6.txt"
Active code page: %d
string(6) "hello5"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ7.txt
string(%d) "เป็นแฟ้มที่ทดสอบ7.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ7.txt"
Active code page: %d
string(6) "hello6"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ8.txt
string(%d) "เป็นแฟ้มที่ทดสอบ8.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ8.txt"
Active code page: %d
string(6) "hello7"
Active code page: %d
getting basename of %sเป็นแฟ้มที่ทดสอบ8 10.txt
string(%d) "เป็นแฟ้มที่ทดสอบ8 10.txt"
bool(true)
string(%d) "%sเป็นแฟ้มที่ทดสอบ8 10.txt"
Active code page: %d
string(6) "hello8"
===DONE===
|