mirror of
https://github.com/php/php-src.git
synced 2024-10-01 23:06:11 +00:00
250 lines
5.1 KiB
Plaintext
250 lines
5.1 KiB
Plaintext
|
--TEST--
|
|||
|
Test get_html_translation_table() function : basic functionality - HTML 5/Windows-1251
|
|||
|
--FILE--
|
|||
|
<?php
|
|||
|
|
|||
|
function so($a,$b) { return ord($a) - ord($b); }
|
|||
|
|
|||
|
echo "*** Testing get_html_translation_table() : basic functionality - HTML 5/Windows-1251 ***\n";
|
|||
|
|
|||
|
echo "-- with table = HTML_ENTITIES, ENT_COMPAT --\n";
|
|||
|
$table = HTML_ENTITIES;
|
|||
|
$tt = get_html_translation_table($table, ENT_COMPAT | ENT_HTML5, "Windows-1251");
|
|||
|
uksort( $tt, 'so' );
|
|||
|
var_dump( count($tt) );
|
|||
|
print_r( $tt );
|
|||
|
|
|||
|
echo "-- with table = HTML_ENTITIES, ENT_QUOTES --\n";
|
|||
|
$table = HTML_ENTITIES;
|
|||
|
$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "Windows-1251");
|
|||
|
var_dump( count($tt) );
|
|||
|
|
|||
|
echo "-- with table = HTML_ENTITIES, ENT_NOQUOTES --\n";
|
|||
|
$table = HTML_ENTITIES;
|
|||
|
$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "Windows-1251");
|
|||
|
var_dump( count($tt) );
|
|||
|
|
|||
|
echo "-- with table = HTML_SPECIALCHARS, ENT_COMPAT --\n";
|
|||
|
$table = HTML_SPECIALCHARS;
|
|||
|
$tt = get_html_translation_table($table, ENT_COMPAT, "Windows-1251");
|
|||
|
uksort( $tt, 'so' );
|
|||
|
var_dump( count($tt) );
|
|||
|
print_r( $tt );
|
|||
|
|
|||
|
echo "-- with table = HTML_SPECIALCHARS, ENT_QUOTES --\n";
|
|||
|
$table = HTML_SPECIALCHARS;
|
|||
|
$tt = get_html_translation_table($table, ENT_QUOTES | ENT_HTML5, "Windows-1251");
|
|||
|
uksort( $tt, 'so' );
|
|||
|
var_dump( $tt );
|
|||
|
|
|||
|
echo "-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --\n";
|
|||
|
$table = HTML_SPECIALCHARS;
|
|||
|
$tt = get_html_translation_table($table, ENT_NOQUOTES | ENT_HTML5, "Windows-1251");
|
|||
|
uasort( $tt, 'so' );
|
|||
|
var_dump( $tt );
|
|||
|
|
|||
|
|
|||
|
echo "Done\n";
|
|||
|
?>
|
|||
|
--EXPECT--
|
|||
|
*** Testing get_html_translation_table() : basic functionality - HTML 5/Windows-1251 ***
|
|||
|
-- with table = HTML_ENTITIES, ENT_COMPAT --
|
|||
|
int(157)
|
|||
|
Array
|
|||
|
(
|
|||
|
[ ] => 	
|
|||
|
[
|
|||
|
] => 

|
|||
|
[!] => !
|
|||
|
["] => "
|
|||
|
[#] => #
|
|||
|
[$] => $
|
|||
|
[%] => %
|
|||
|
[&] => &
|
|||
|
[(] => (
|
|||
|
[)] => )
|
|||
|
[*] => *
|
|||
|
[+] => +
|
|||
|
[,] => ,
|
|||
|
[.] => .
|
|||
|
[/] => /
|
|||
|
[:] => :
|
|||
|
[;] => ;
|
|||
|
[<] => <
|
|||
|
[=] => =
|
|||
|
[>] => >
|
|||
|
[?] => ?
|
|||
|
[@] => @
|
|||
|
[[] => [
|
|||
|
[\] => \
|
|||
|
[]] => ]
|
|||
|
[^] => ^
|
|||
|
[_] => _
|
|||
|
[`] => `
|
|||
|
[fj] => &fjlig
|
|||
|
[{] => {
|
|||
|
[|] => |
|
|||
|
[}] => }
|
|||
|
[<5B>] => Ђ
|
|||
|
[<5B>] => Ѓ
|
|||
|
[<5B>] => ‚
|
|||
|
[<5B>] => ѓ
|
|||
|
[<5B>] => „
|
|||
|
[<5B>] => …
|
|||
|
[<5B>] => †
|
|||
|
[<5B>] => ‡
|
|||
|
[<5B>] => €
|
|||
|
[<5B>] => ‰
|
|||
|
[<5B>] => Љ
|
|||
|
[<5B>] => ‹
|
|||
|
[<5B>] => Њ
|
|||
|
[<5B>] => Ќ
|
|||
|
[<5B>] => Ћ
|
|||
|
[<5B>] => Џ
|
|||
|
[<5B>] => ђ
|
|||
|
[<5B>] => ‘
|
|||
|
[<5B>] => ’
|
|||
|
[<5B>] => “
|
|||
|
[<5B>] => ”
|
|||
|
[<5B>] => •
|
|||
|
[<5B>] => –
|
|||
|
[<5B>] => —
|
|||
|
[<5B>] => ™
|
|||
|
[<5B>] => љ
|
|||
|
[<5B>] => ›
|
|||
|
[<5B>] => њ
|
|||
|
[<5B>] => ќ
|
|||
|
[<5B>] => ћ
|
|||
|
[<5B>] => џ
|
|||
|
[<5B>] =>
|
|||
|
[<5B>] => Ў
|
|||
|
[<5B>] => ў
|
|||
|
[<5B>] => Ј
|
|||
|
[<5B>] => ¤
|
|||
|
[<5B>] => ¦
|
|||
|
[<5B>] => §
|
|||
|
[<5B>] => Ё
|
|||
|
[<5B>] => ©
|
|||
|
[<5B>] => Є
|
|||
|
[<5B>] => «
|
|||
|
[<5B>] => ¬
|
|||
|
[<5B>] => ­
|
|||
|
[<5B>] => ®
|
|||
|
[<5B>] => Ї
|
|||
|
[<5B>] => °
|
|||
|
[<5B>] => ±
|
|||
|
[<5B>] => І
|
|||
|
[<5B>] => і
|
|||
|
[<5B>] => µ
|
|||
|
[<5B>] => ¶
|
|||
|
[<5B>] => ·
|
|||
|
[<5B>] => ё
|
|||
|
[<5B>] => №
|
|||
|
[<5B>] => є
|
|||
|
[<5B>] => »
|
|||
|
[<5B>] => ј
|
|||
|
[<5B>] => Ѕ
|
|||
|
[<5B>] => ѕ
|
|||
|
[<5B>] => ї
|
|||
|
[<5B>] => А
|
|||
|
[<5B>] => Б
|
|||
|
[<5B>] => В
|
|||
|
[<5B>] => Г
|
|||
|
[<5B>] => Д
|
|||
|
[<5B>] => Е
|
|||
|
[<5B>] => Ж
|
|||
|
[<5B>] => З
|
|||
|
[<5B>] => И
|
|||
|
[<5B>] => Й
|
|||
|
[<5B>] => К
|
|||
|
[<5B>] => Л
|
|||
|
[<5B>] => М
|
|||
|
[<5B>] => Н
|
|||
|
[<5B>] => О
|
|||
|
[<5B>] => П
|
|||
|
[<5B>] => Р
|
|||
|
[<5B>] => С
|
|||
|
[<5B>] => Т
|
|||
|
[<5B>] => У
|
|||
|
[<5B>] => Ф
|
|||
|
[<5B>] => Х
|
|||
|
[<5B>] => Ц
|
|||
|
[<5B>] => Ч
|
|||
|
[<5B>] => Ш
|
|||
|
[<5B>] => Щ
|
|||
|
[<5B>] => Ъ
|
|||
|
[<5B>] => Ы
|
|||
|
[<5B>] => Ь
|
|||
|
[<5B>] => Э
|
|||
|
[<5B>] => Ю
|
|||
|
[<5B>] => Я
|
|||
|
[<5B>] => а
|
|||
|
[<5B>] => б
|
|||
|
[<5B>] => в
|
|||
|
[<5B>] => г
|
|||
|
[<5B>] => д
|
|||
|
[<5B>] => е
|
|||
|
[<5B>] => ж
|
|||
|
[<5B>] => з
|
|||
|
[<5B>] => и
|
|||
|
[<5B>] => й
|
|||
|
[<5B>] => к
|
|||
|
[<5B>] => л
|
|||
|
[<5B>] => м
|
|||
|
[<5B>] => н
|
|||
|
[<5B>] => о
|
|||
|
[<5B>] => п
|
|||
|
[<5B>] => р
|
|||
|
[<5B>] => с
|
|||
|
[<5B>] => т
|
|||
|
[<5B>] => у
|
|||
|
[<5B>] => ф
|
|||
|
[<5B>] => х
|
|||
|
[<5B>] => ц
|
|||
|
[<5B>] => ч
|
|||
|
[<5B>] => ш
|
|||
|
[<5B>] => щ
|
|||
|
[<5B>] => ъ
|
|||
|
[<5B>] => ы
|
|||
|
[<5B>] => ь
|
|||
|
[<5B>] => э
|
|||
|
[<5B>] => ю
|
|||
|
[<5B>] => я
|
|||
|
)
|
|||
|
-- with table = HTML_ENTITIES, ENT_QUOTES --
|
|||
|
int(158)
|
|||
|
-- with table = HTML_ENTITIES, ENT_NOQUOTES --
|
|||
|
int(156)
|
|||
|
-- with table = HTML_SPECIALCHARS, ENT_COMPAT --
|
|||
|
int(4)
|
|||
|
Array
|
|||
|
(
|
|||
|
["] => "
|
|||
|
[&] => &
|
|||
|
[<] => <
|
|||
|
[>] => >
|
|||
|
)
|
|||
|
-- with table = HTML_SPECIALCHARS, ENT_QUOTES --
|
|||
|
array(5) {
|
|||
|
["""]=>
|
|||
|
string(6) """
|
|||
|
["&"]=>
|
|||
|
string(5) "&"
|
|||
|
["'"]=>
|
|||
|
string(6) "'"
|
|||
|
["<"]=>
|
|||
|
string(4) "<"
|
|||
|
[">"]=>
|
|||
|
string(4) ">"
|
|||
|
}
|
|||
|
-- with table = HTML_SPECIALCHARS, ENT_NOQUOTES --
|
|||
|
array(3) {
|
|||
|
[">"]=>
|
|||
|
string(4) ">"
|
|||
|
["<"]=>
|
|||
|
string(4) "<"
|
|||
|
["&"]=>
|
|||
|
string(5) "&"
|
|||
|
}
|
|||
|
Done
|