File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
html_entity_decode_macroman.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue May 29 12:34:45 2012 UTC (12 years, 2 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
HEAD
php 5.4.3+patches
--TEST--
Translation of HTML entities for encoding MacRoman
--FILE--
<?php
$arr = array(
0x00C4 => array(0x80, "LATIN CAPITAL LETTER A WITH DIAERESIS"),
0x00C5 => array(0x81, "LATIN CAPITAL LETTER A WITH RING ABOVE"),
0x00C7 => array(0x82, "LATIN CAPITAL LETTER C WITH CEDILLA"),
0x00C9 => array(0x83, "LATIN CAPITAL LETTER E WITH ACUTE"),
0x00D1 => array(0x84, "LATIN CAPITAL LETTER N WITH TILDE"),
0x00D6 => array(0x85, "LATIN CAPITAL LETTER O WITH DIAERESIS"),
0x00DC => array(0x86, "LATIN CAPITAL LETTER U WITH DIAERESIS"),
0x00E1 => array(0x87, "LATIN SMALL LETTER A WITH ACUTE"),
0x00E0 => array(0x88, "LATIN SMALL LETTER A WITH GRAVE"),
0x00E2 => array(0x89, "LATIN SMALL LETTER A WITH CIRCUMFLEX"),
0x00E4 => array(0x8A, "LATIN SMALL LETTER A WITH DIAERESIS"),
0x00E3 => array(0x8B, "LATIN SMALL LETTER A WITH TILDE"),
0x00E5 => array(0x8C, "LATIN SMALL LETTER A WITH RING ABOVE"),
0x00E7 => array(0x8D, "LATIN SMALL LETTER C WITH CEDILLA"),
0x00E9 => array(0x8E, "LATIN SMALL LETTER E WITH ACUTE"),
0x00E8 => array(0x8F, "LATIN SMALL LETTER E WITH GRAVE"),
0x00EA => array(0x90, "LATIN SMALL LETTER E WITH CIRCUMFLEX"),
0x00EB => array(0x91, "LATIN SMALL LETTER E WITH DIAERESIS"),
0x00ED => array(0x92, "LATIN SMALL LETTER I WITH ACUTE"),
0x00EC => array(0x93, "LATIN SMALL LETTER I WITH GRAVE"),
0x00EE => array(0x94, "LATIN SMALL LETTER I WITH CIRCUMFLEX"),
0x00EF => array(0x95, "LATIN SMALL LETTER I WITH DIAERESIS"),
0x00F1 => array(0x96, "LATIN SMALL LETTER N WITH TILDE"),
0x00F3 => array(0x97, "LATIN SMALL LETTER O WITH ACUTE"),
0x00F2 => array(0x98, "LATIN SMALL LETTER O WITH GRAVE"),
0x00F4 => array(0x99, "LATIN SMALL LETTER O WITH CIRCUMFLEX"),
0x00F6 => array(0x9A, "LATIN SMALL LETTER O WITH DIAERESIS"),
0x00F5 => array(0x9B, "LATIN SMALL LETTER O WITH TILDE"),
0x00FA => array(0x9C, "LATIN SMALL LETTER U WITH ACUTE"),
0x00F9 => array(0x9D, "LATIN SMALL LETTER U WITH GRAVE"),
0x00FB => array(0x9E, "LATIN SMALL LETTER U WITH CIRCUMFLEX"),
0x00FC => array(0x9F, "LATIN SMALL LETTER U WITH DIAERESIS"),
0x2020 => array(0xA0, "DAGGER"),
0x00B0 => array(0xA1, "DEGREE SIGN"),
0x00A2 => array(0xA2, "CENT SIGN"),
0x00A3 => array(0xA3, "POUND SIGN"),
0x00A7 => array(0xA4, "SECTION SIGN"),
0x2022 => array(0xA5, "BULLET"),
0x00B6 => array(0xA6, "PILCROW SIGN"),
0x00DF => array(0xA7, "LATIN SMALL LETTER SHARP S"),
0x00AE => array(0xA8, "REGISTERED SIGN"),
0x00A9 => array(0xA9, "COPYRIGHT SIGN"),
0x2122 => array(0xAA, "TRADE MARK SIGN"),
0x00B4 => array(0xAB, "ACUTE ACCENT"),
0x00A8 => array(0xAC, "DIAERESIS"),
0x2260 => array(0xAD, "NOT EQUAL TO"),
0x00C6 => array(0xAE, "LATIN CAPITAL LETTER AE"),
0x00D8 => array(0xAF, "LATIN CAPITAL LETTER O WITH STROKE"),
0x221E => array(0xB0, "INFINITY"),
0x00B1 => array(0xB1, "PLUS-MINUS SIGN"),
0x2264 => array(0xB2, "LESS-THAN OR EQUAL TO"),
0x2265 => array(0xB3, "GREATER-THAN OR EQUAL TO"),
0x00A5 => array(0xB4, "YEN SIGN"),
0x00B5 => array(0xB5, "MICRO SIGN"),
0x2202 => array(0xB6, "PARTIAL DIFFERENTIAL"),
0x2211 => array(0xB7, "N-ARY SUMMATION"),
0x220F => array(0xB8, "N-ARY PRODUCT"),
0x03C0 => array(0xB9, "GREEK SMALL LETTER PI"),
0x222B => array(0xBA, "INTEGRAL"),
0x00AA => array(0xBB, "FEMININE ORDINAL INDICATOR"),
0x00BA => array(0xBC, "MASCULINE ORDINAL INDICATOR"),
0x03A9 => array(0xBD, "GREEK CAPITAL LETTER OMEGA"),
0x00E6 => array(0xBE, "LATIN SMALL LETTER AE"),
0x00F8 => array(0xBF, "LATIN SMALL LETTER O WITH STROKE"),
0x00BF => array(0xC0, "INVERTED QUESTION MARK"),
0x00A1 => array(0xC1, "INVERTED EXCLAMATION MARK"),
0x00AC => array(0xC2, "NOT SIGN"),
0x221A => array(0xC3, "SQUARE ROOT"),
0x0192 => array(0xC4, "LATIN SMALL LETTER F WITH HOOK"),
0x2248 => array(0xC5, "ALMOST EQUAL TO"),
0x2206 => array(0xC6, "INCREMENT"),
0x00AB => array(0xC7, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"),
0x00BB => array(0xC8, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"),
0x2026 => array(0xC9, "HORIZONTAL ELLIPSIS"),
0x00A0 => array(0xCA, "NO-BREAK SPACE"),
0x00C0 => array(0xCB, "LATIN CAPITAL LETTER A WITH GRAVE"),
0x00C3 => array(0xCC, "LATIN CAPITAL LETTER A WITH TILDE"),
0x00D5 => array(0xCD, "LATIN CAPITAL LETTER O WITH TILDE"),
0x0152 => array(0xCE, "LATIN CAPITAL LIGATURE OE"),
0x0153 => array(0xCF, "LATIN SMALL LIGATURE OE"),
0x2013 => array(0xD0, "EN DASH"),
0x2014 => array(0xD1, "EM DASH"),
0x201C => array(0xD2, "LEFT DOUBLE QUOTATION MARK"),
0x201D => array(0xD3, "RIGHT DOUBLE QUOTATION MARK"),
0x2018 => array(0xD4, "LEFT SINGLE QUOTATION MARK"),
0x2019 => array(0xD5, "RIGHT SINGLE QUOTATION MARK"),
0x00F7 => array(0xD6, "DIVISION SIGN"),
0x25CA => array(0xD7, "LOZENGE"),
0x00FF => array(0xD8, "LATIN SMALL LETTER Y WITH DIAERESIS"),
0x0178 => array(0xD9, "LATIN CAPITAL LETTER Y WITH DIAERESIS"),
0x2044 => array(0xDA, "FRACTION SLASH"),
0x20AC => array(0xDB, "EURO SIGN"),
0x2039 => array(0xDC, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"),
0x203A => array(0xDD, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"),
0xFB01 => array(0xDE, "LATIN SMALL LIGATURE FI"),
0xFB02 => array(0xDF, "LATIN SMALL LIGATURE FL"),
0x2021 => array(0xE0, "DOUBLE DAGGER"),
0x00B7 => array(0xE1, "MIDDLE DOT"),
0x201A => array(0xE2, "SINGLE LOW-9 QUOTATION MARK"),
0x201E => array(0xE3, "DOUBLE LOW-9 QUOTATION MARK"),
0x2030 => array(0xE4, "PER MILLE SIGN"),
0x00C2 => array(0xE5, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"),
0x00CA => array(0xE6, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"),
0x00C1 => array(0xE7, "LATIN CAPITAL LETTER A WITH ACUTE"),
0x00CB => array(0xE8, "LATIN CAPITAL LETTER E WITH DIAERESIS"),
0x00C8 => array(0xE9, "LATIN CAPITAL LETTER E WITH GRAVE"),
0x00CD => array(0xEA, "LATIN CAPITAL LETTER I WITH ACUTE"),
0x00CE => array(0xEB, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"),
0x00CF => array(0xEC, "LATIN CAPITAL LETTER I WITH DIAERESIS"),
0x00CC => array(0xED, "LATIN CAPITAL LETTER I WITH GRAVE"),
0x00D3 => array(0xEE, "LATIN CAPITAL LETTER O WITH ACUTE"),
0x00D4 => array(0xEF, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"),
0xF8FF => array(0xF0, "Apple logo"),
0x00D2 => array(0xF1, "LATIN CAPITAL LETTER O WITH GRAVE"),
0x00DA => array(0xF2, "LATIN CAPITAL LETTER U WITH ACUTE"),
0x00DB => array(0xF3, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"),
0x00D9 => array(0xF4, "LATIN CAPITAL LETTER U WITH GRAVE"),
0x0131 => array(0xF5, "LATIN SMALL LETTER DOTLESS I"),
0x02C6 => array(0xF6, "MODIFIER LETTER CIRCUMFLEX ACCENT"),
0x02DC => array(0xF7, "SMALL TILDE"),
0x00AF => array(0xF8, "MACRON"),
0x02D8 => array(0xF9, "BREVE"),
0x02D9 => array(0xFA, "DOT ABOVE"),
0x02DA => array(0xFB, "RING ABOVE"),
0x00B8 => array(0xFC, "CEDILLA"),
0x02DD => array(0xFD, "DOUBLE ACUTE ACCENT"),
0x02DB => array(0xFE, "OGONEK"),
0x02C7 => array(0xFF, "CARON"),
);
$res = html_entity_decode("", ENT_QUOTES, 'MacRoman');
echo "Special test for  (shouldn't decode):\n";
echo $res,"\n\n";
foreach ($arr as $u => $v) {
$ent = sprintf("&#x%X;", $u);
$res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman');
$d = unpack("H*", $res);
echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
$ent = sprintf("&#x%X;", $v[0]);
$res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman');
if ($res[0] != "&" || $res[1] != "#")
$res = unpack("H*", $res)[1];
echo sprintf("%s => %s\n\n", $ent, $res);
}
--EXPECT--
Special test for  (shouldn't decode):

LATIN CAPITAL LETTER A WITH DIAERESIS: Ä => 80
€ => €
LATIN CAPITAL LETTER A WITH RING ABOVE: Å => 81
 => 
LATIN CAPITAL LETTER C WITH CEDILLA: Ç => 82
‚ => ‚
LATIN CAPITAL LETTER E WITH ACUTE: É => 83
ƒ => ƒ
LATIN CAPITAL LETTER N WITH TILDE: Ñ => 84
„ => „
LATIN CAPITAL LETTER O WITH DIAERESIS: Ö => 85
… => …
LATIN CAPITAL LETTER U WITH DIAERESIS: Ü => 86
† => †
LATIN SMALL LETTER A WITH ACUTE: á => 87
‡ => ‡
LATIN SMALL LETTER A WITH GRAVE: à => 88
ˆ => ˆ
LATIN SMALL LETTER A WITH CIRCUMFLEX: â => 89
‰ => ‰
LATIN SMALL LETTER A WITH DIAERESIS: ä => 8a
Š => Š
LATIN SMALL LETTER A WITH TILDE: ã => 8b
‹ => ‹
LATIN SMALL LETTER A WITH RING ABOVE: å => 8c
Œ => Œ
LATIN SMALL LETTER C WITH CEDILLA: ç => 8d
 => 
LATIN SMALL LETTER E WITH ACUTE: é => 8e
Ž => Ž
LATIN SMALL LETTER E WITH GRAVE: è => 8f
 => 
LATIN SMALL LETTER E WITH CIRCUMFLEX: ê => 90
 => 
LATIN SMALL LETTER E WITH DIAERESIS: ë => 91
‘ => ‘
LATIN SMALL LETTER I WITH ACUTE: í => 92
’ => ’
LATIN SMALL LETTER I WITH GRAVE: ì => 93
“ => “
LATIN SMALL LETTER I WITH CIRCUMFLEX: î => 94
” => ”
LATIN SMALL LETTER I WITH DIAERESIS: ï => 95
• => •
LATIN SMALL LETTER N WITH TILDE: ñ => 96
– => –
LATIN SMALL LETTER O WITH ACUTE: ó => 97
— => —
LATIN SMALL LETTER O WITH GRAVE: ò => 98
˜ => ˜
LATIN SMALL LETTER O WITH CIRCUMFLEX: ô => 99
™ => ™
LATIN SMALL LETTER O WITH DIAERESIS: ö => 9a
š => š
LATIN SMALL LETTER O WITH TILDE: õ => 9b
› => ›
LATIN SMALL LETTER U WITH ACUTE: ú => 9c
œ => œ
LATIN SMALL LETTER U WITH GRAVE: ù => 9d
 => 
LATIN SMALL LETTER U WITH CIRCUMFLEX: û => 9e
ž => ž
LATIN SMALL LETTER U WITH DIAERESIS: ü => 9f
Ÿ => Ÿ
DAGGER: † => a0
  => ca
DEGREE SIGN: ° => a1
¡ => c1
CENT SIGN: ¢ => a2
¢ => a2
POUND SIGN: £ => a3
£ => a3
SECTION SIGN: § => a4
¤ => ¤
BULLET: • => a5
¥ => b4
PILCROW SIGN: ¶ => a6
¦ => ¦
LATIN SMALL LETTER SHARP S: ß => a7
§ => a4
REGISTERED SIGN: ® => a8
¨ => ac
COPYRIGHT SIGN: © => a9
© => a9
TRADE MARK SIGN: ™ => aa
ª => bb
ACUTE ACCENT: ´ => ab
« => c7
DIAERESIS: ¨ => ac
¬ => c2
NOT EQUAL TO: ≠ => ad
­ => ­
LATIN CAPITAL LETTER AE: Æ => ae
® => a8
LATIN CAPITAL LETTER O WITH STROKE: Ø => af
¯ => f8
INFINITY: ∞ => b0
° => a1
PLUS-MINUS SIGN: ± => b1
± => b1
LESS-THAN OR EQUAL TO: ≤ => b2
² => ²
GREATER-THAN OR EQUAL TO: ≥ => b3
³ => ³
YEN SIGN: ¥ => b4
´ => ab
MICRO SIGN: µ => b5
µ => b5
PARTIAL DIFFERENTIAL: ∂ => b6
¶ => a6
N-ARY SUMMATION: ∑ => b7
· => e1
N-ARY PRODUCT: ∏ => b8
¸ => fc
GREEK SMALL LETTER PI: π => b9
¹ => ¹
INTEGRAL: ∫ => ba
º => bc
FEMININE ORDINAL INDICATOR: ª => bb
» => c8
MASCULINE ORDINAL INDICATOR: º => bc
¼ => ¼
GREEK CAPITAL LETTER OMEGA: Ω => bd
½ => ½
LATIN SMALL LETTER AE: æ => be
¾ => ¾
LATIN SMALL LETTER O WITH STROKE: ø => bf
¿ => c0
INVERTED QUESTION MARK: ¿ => c0
À => cb
INVERTED EXCLAMATION MARK: ¡ => c1
Á => e7
NOT SIGN: ¬ => c2
 => e5
SQUARE ROOT: √ => c3
à => cc
LATIN SMALL LETTER F WITH HOOK: ƒ => c4
Ä => 80
ALMOST EQUAL TO: ≈ => c5
Å => 81
INCREMENT: ∆ => c6
Æ => ae
LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => c7
Ç => 82
RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => c8
È => e9
HORIZONTAL ELLIPSIS: … => c9
É => 83
NO-BREAK SPACE:   => ca
Ê => e6
LATIN CAPITAL LETTER A WITH GRAVE: À => cb
Ë => e8
LATIN CAPITAL LETTER A WITH TILDE: Ã => cc
Ì => ed
LATIN CAPITAL LETTER O WITH TILDE: Õ => cd
Í => ea
LATIN CAPITAL LIGATURE OE: Œ => ce
Î => eb
LATIN SMALL LIGATURE OE: œ => cf
Ï => ec
EN DASH: – => d0
Ð => Ð
EM DASH: — => d1
Ñ => 84
LEFT DOUBLE QUOTATION MARK: “ => d2
Ò => f1
RIGHT DOUBLE QUOTATION MARK: ” => d3
Ó => ee
LEFT SINGLE QUOTATION MARK: ‘ => d4
Ô => ef
RIGHT SINGLE QUOTATION MARK: ’ => d5
Õ => cd
DIVISION SIGN: ÷ => d6
Ö => 85
LOZENGE: ◊ => d7
× => ×
LATIN SMALL LETTER Y WITH DIAERESIS: ÿ => d8
Ø => af
LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => d9
Ù => f4
FRACTION SLASH: ⁄ => da
Ú => f2
EURO SIGN: € => db
Û => f3
SINGLE LEFT-POINTING ANGLE QUOTATION MARK: ‹ => dc
Ü => 86
SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: › => dd
Ý => Ý
LATIN SMALL LIGATURE FI: fi => de
Þ => Þ
LATIN SMALL LIGATURE FL: fl => df
ß => a7
DOUBLE DAGGER: ‡ => e0
à => 88
MIDDLE DOT: · => e1
á => 87
SINGLE LOW-9 QUOTATION MARK: ‚ => e2
â => 89
DOUBLE LOW-9 QUOTATION MARK: „ => e3
ã => 8b
PER MILLE SIGN: ‰ => e4
ä => 8a
LATIN CAPITAL LETTER A WITH CIRCUMFLEX: Â => e5
å => 8c
LATIN CAPITAL LETTER E WITH CIRCUMFLEX: Ê => e6
æ => be
LATIN CAPITAL LETTER A WITH ACUTE: Á => e7
ç => 8d
LATIN CAPITAL LETTER E WITH DIAERESIS: Ë => e8
è => 8f
LATIN CAPITAL LETTER E WITH GRAVE: È => e9
é => 8e
LATIN CAPITAL LETTER I WITH ACUTE: Í => ea
ê => 90
LATIN CAPITAL LETTER I WITH CIRCUMFLEX: Î => eb
ë => 91
LATIN CAPITAL LETTER I WITH DIAERESIS: Ï => ec
ì => 93
LATIN CAPITAL LETTER I WITH GRAVE: Ì => ed
í => 92
LATIN CAPITAL LETTER O WITH ACUTE: Ó => ee
î => 94
LATIN CAPITAL LETTER O WITH CIRCUMFLEX: Ô => ef
ï => 95
Apple logo:  => f0
ð => ð
LATIN CAPITAL LETTER O WITH GRAVE: Ò => f1
ñ => 96
LATIN CAPITAL LETTER U WITH ACUTE: Ú => f2
ò => 98
LATIN CAPITAL LETTER U WITH CIRCUMFLEX: Û => f3
ó => 97
LATIN CAPITAL LETTER U WITH GRAVE: Ù => f4
ô => 99
LATIN SMALL LETTER DOTLESS I: ı => f5
õ => 9b
MODIFIER LETTER CIRCUMFLEX ACCENT: ˆ => f6
ö => 9a
SMALL TILDE: ˜ => f7
÷ => d6
MACRON: ¯ => f8
ø => bf
BREVE: ˘ => f9
ù => 9d
DOT ABOVE: ˙ => fa
ú => 9c
RING ABOVE: ˚ => fb
û => 9e
CEDILLA: ¸ => fc
ü => 9f
DOUBLE ACUTE ACCENT: ˝ => fd
ý => ý
OGONEK: ˛ => fe
þ => þ
CARON: ˇ => ff
ÿ => d8
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>