1--TEST--
2htmlentities() / htmlspecialchars() ENT_DISALLOWED charset variation
3--FILE--
4<?php
5$tests = array(
6    0x00, //C0
7    0x01,
8    0x09,
9    0x0A,
10    0x0B,
11    0x0C,
12    0x0D,
13    0x0E,
14    0x1F,
15    0x20, //allowed always
16    0x7F, //DEL
17    0x80, //C1
18    0x9F,
19    0xA0, //allowed always
20);
21
22function test($flag, $charset) {
23    global $tests;
24    $i = -1;
25    foreach ($tests as $test) {
26        $test = chr($test);
27        $i++;
28        $a = htmlentities($test, $flag | ENT_DISALLOWED, $charset);
29        $b = htmlspecialchars($test, $flag | ENT_DISALLOWED, $charset);
30        if ($a == "" && $b == "") { echo sprintf("%05X", $tests[$i]), ": INVALID SEQUENCE\n"; continue; }
31        echo sprintf("%05X", $tests[$i]), ": ", bin2hex($a), " ", bin2hex($b), "\n";
32    }
33}
34
35echo "*** Testing HTML 4.01/Windows-1251 ***\n";
36
37test(ENT_HTML401, "Windows-1251");
38
39echo "\n*** Testing XHTML 1.0/Windows-1251 ***\n";
40
41test(ENT_XHTML, "Windows-1251");
42
43echo "\n*** Testing HTML 5/Windows-1251 ***\n";
44
45test(ENT_HTML5, "Windows-1251");
46
47echo "\n*** Testing XML 1.0/Windows-1251 ***\n";
48
49test(ENT_XML1, "Windows-1251");
50
51echo "\n*** Testing HTML 4.01/SJIS ***\n";
52
53test(ENT_HTML401, "SJIS");
54
55echo "\n*** Testing XHTML 1.0/SJIS ***\n";
56
57test(ENT_XHTML, "SJIS");
58
59echo "\n*** Testing HTML 5/SJIS ***\n";
60
61test(ENT_HTML5, "SJIS");
62
63echo "\n*** Testing XML 1.0/SJIS ***\n";
64
65test(ENT_XML1, "SJIS");
66
67
68?>
69--EXPECTF--
70*** Testing HTML 4.01/Windows-1251 ***
7100000: 262378464646443b 262378464646443b
7200001: 262378464646443b 262378464646443b
7300009: 09 09
740000A: 0a 0a
750000B: 262378464646443b 262378464646443b
760000C: 262378464646443b 262378464646443b
770000D: 0d 0d
780000E: 262378464646443b 262378464646443b
790001F: 262378464646443b 262378464646443b
8000020: 20 20
810007F: 262378464646443b 7f
8200080: 80 80
830009F: 9f 9f
84000A0: 266e6273703b a0
85
86*** Testing XHTML 1.0/Windows-1251 ***
8700000: 262378464646443b 262378464646443b
8800001: 262378464646443b 262378464646443b
8900009: 09 09
900000A: 0a 0a
910000B: 262378464646443b 262378464646443b
920000C: 262378464646443b 262378464646443b
930000D: 0d 0d
940000E: 262378464646443b 262378464646443b
950001F: 262378464646443b 262378464646443b
9600020: 20 20
970007F: 7f 7f
9800080: 80 80
990009F: 9f 9f
100000A0: 266e6273703b a0
101
102*** Testing HTML 5/Windows-1251 ***
10300000: 262378464646443b 262378464646443b
10400001: 262378464646443b 262378464646443b
10500009: 265461623b 09
1060000A: 264e65774c696e653b 0a
1070000B: 262378464646443b 262378464646443b
1080000C: 0c 0c
1090000D: 0d 0d
1100000E: 262378464646443b 262378464646443b
1110001F: 262378464646443b 262378464646443b
11200020: 20 20
1130007F: 262378464646443b 7f
11400080: 26444a63793b 80
1150009F: 26647a63793b 9f
116000A0: 266e6273703b a0
117
118*** Testing XML 1.0/Windows-1251 ***
11900000: 262378464646443b 262378464646443b
12000001: 262378464646443b 262378464646443b
12100009: 09 09
1220000A: 0a 0a
1230000B: 262378464646443b 262378464646443b
1240000C: 262378464646443b 262378464646443b
1250000D: 0d 0d
1260000E: 262378464646443b 262378464646443b
1270001F: 262378464646443b 262378464646443b
12800020: 20 20
1290007F: 7f 7f
13000080: 80 80
1310009F: 9f 9f
132000A0: a0 a0
133
134*** Testing HTML 4.01/SJIS ***
135
136Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
13700000: 262378464646443b 262378464646443b
138
139Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
14000001: 262378464646443b 262378464646443b
141
142Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
14300009: 09 09
144
145Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1460000A: 0a 0a
147
148Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1490000B: 262378464646443b 262378464646443b
150
151Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1520000C: 262378464646443b 262378464646443b
153
154Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1550000D: 0d 0d
156
157Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1580000E: 262378464646443b 262378464646443b
159
160Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1610001F: 262378464646443b 262378464646443b
162
163Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
16400020: 20 20
165
166Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1670007F: 7f 7f
168
169Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
17000080: INVALID SEQUENCE
171
172Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1730009F: INVALID SEQUENCE
174
175Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
176000A0: INVALID SEQUENCE
177
178*** Testing XHTML 1.0/SJIS ***
179
180Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
18100000: 262378464646443b 262378464646443b
182
183Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
18400001: 262378464646443b 262378464646443b
185
186Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
18700009: 09 09
188
189Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1900000A: 0a 0a
191
192Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1930000B: 262378464646443b 262378464646443b
194
195Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1960000C: 262378464646443b 262378464646443b
197
198Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
1990000D: 0d 0d
200
201Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2020000E: 262378464646443b 262378464646443b
203
204Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2050001F: 262378464646443b 262378464646443b
206
207Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
20800020: 20 20
209
210Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2110007F: 7f 7f
212
213Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
21400080: INVALID SEQUENCE
215
216Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2170009F: INVALID SEQUENCE
218
219Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
220000A0: INVALID SEQUENCE
221
222*** Testing HTML 5/SJIS ***
223
224Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
22500000: 262378464646443b 262378464646443b
226
227Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
22800001: 262378464646443b 262378464646443b
229
230Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
23100009: 09 09
232
233Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2340000A: 0a 0a
235
236Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2370000B: 262378464646443b 262378464646443b
238
239Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2400000C: 0c 0c
241
242Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2430000D: 0d 0d
244
245Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2460000E: 262378464646443b 262378464646443b
247
248Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2490001F: 262378464646443b 262378464646443b
250
251Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
25200020: 20 20
253
254Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2550007F: 7f 7f
256
257Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
25800080: INVALID SEQUENCE
259
260Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2610009F: INVALID SEQUENCE
262
263Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
264000A0: INVALID SEQUENCE
265
266*** Testing XML 1.0/SJIS ***
267
268Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
26900000: 262378464646443b 262378464646443b
270
271Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
27200001: 262378464646443b 262378464646443b
273
274Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
27500009: 09 09
276
277Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2780000A: 0a 0a
279
280Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2810000B: 262378464646443b 262378464646443b
282
283Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2840000C: 262378464646443b 262378464646443b
285
286Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2870000D: 0d 0d
288
289Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2900000E: 262378464646443b 262378464646443b
291
292Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2930001F: 262378464646443b 262378464646443b
294
295Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
29600020: 20 20
297
298Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
2990007F: 7f 7f
300
301Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
30200080: INVALID SEQUENCE
303
304Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
3050009F: INVALID SEQUENCE
306
307Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
308000A0: INVALID SEQUENCE
309