Annotation of embedaddon/php/ext/standard/tests/strings/htmlentities19.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: htmlentities() / htmlspecialchars() ENT_SUBSTITUTE
3: --FILE--
4: <?php
5: $tests = array(
6: "\x41\xC2\x3E\x42", // Unicode TR #36, 3.1.1; do not consume valid successor bytes
7: "\xE3\x80\x22", // Unicode TR #36, 3.6.1; use strategy #2
8: "\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98", // example from HTML5, section 2.4
9: );
10:
11: foreach ($tests as $test) {
12: $a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
13: var_dump($a, bin2hex($a));
14: $a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
15: var_dump($a, bin2hex($a));
16: }
17: ?>
18: --EXPECT--
19: string(9) "A�>B"
20: string(18) "41efbfbd2667743b42"
21: string(9) "A�>B"
22: string(18) "41efbfbd2667743b42"
23: string(9) "�""
24: string(18) "efbfbd2671756f743b"
25: string(9) "�""
26: string(18) "efbfbd2671756f743b"
27: string(18) "A��B�C☺�"
28: string(36) "41efbfbdefbfbd42efbfbd43e298baefbfbd"
29: string(18) "A��B�C☺�"
30: string(36) "41efbfbdefbfbd42efbfbd43e298baefbfbd"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>