1--TEST--
2Translation of HTML entities for encoding WIN-1252
3--FILE--
4<?php
5$arr = array(
60x20AC => array(0x80, "EURO SIGN"),
7//0x81	      	#UNDEFINED
80x201A => array(0x82, "SINGLE LOW-9 QUOTATION MARK"),
90x0192 => array(0x83, "LATIN SMALL LETTER F WITH HOOK"),
100x201E => array(0x84, "DOUBLE LOW-9 QUOTATION MARK"),
110x2026 => array(0x85, "HORIZONTAL ELLIPSIS"),
120x2020 => array(0x86, "DAGGER"),
130x2021 => array(0x87, "DOUBLE DAGGER"),
140x02C6 => array(0x88, "MODIFIER LETTER CIRCUMFLEX ACCENT"),
150x2030 => array(0x89, "PER MILLE SIGN"),
160x0160 => array(0x8A, "LATIN CAPITAL LETTER S WITH CARON"),
170x2039 => array(0x8B, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"),
180x0152 => array(0x8C, "LATIN CAPITAL LIGATURE OE"),
19//0x8D	      	#UNDEFINED
200x017D => array(0x8E, "LATIN CAPITAL LETTER Z WITH CARON"),
21//0x8F	      	#UNDEFINED
22//0x90	      	#UNDEFINED
230x2018 => array(0x91, "LEFT SINGLE QUOTATION MARK"),
240x2019 => array(0x92, "RIGHT SINGLE QUOTATION MARK"),
250x201C => array(0x93, "LEFT DOUBLE QUOTATION MARK"),
260x201D => array(0x94, "RIGHT DOUBLE QUOTATION MARK"),
270x2022 => array(0x95, "BULLET"),
280x2013 => array(0x96, "EN DASH"),
290x2014 => array(0x97, "EM DASH"),
300x02DC => array(0x98, "SMALL TILDE"),
310x2122 => array(0x99, "TRADE MARK SIGN"),
320x0161 => array(0x9A, "LATIN SMALL LETTER S WITH CARON"),
330x203A => array(0x9B, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"),
340x0153 => array(0x9C, "LATIN SMALL LIGATURE OE"),
35//0x9D	      	#UNDEFINED
360x017E => array(0x9E, "LATIN SMALL LETTER Z WITH CARON"),
370x0178 => array(0x9F, "LATIN CAPITAL LETTER Y WITH DIAERESIS"),
38);
39
40$res = html_entity_decode("&#x81;", ENT_QUOTES, 'WINDOWS-1252');
41echo "Special test for &#x81; (shouldn't decode):\n";
42echo $res,"\n\n";
43
44$res = html_entity_decode("&#x8D;", ENT_QUOTES, 'WINDOWS-1252');
45echo "Special test for &#x8D; (shouldn't decode):\n";
46echo $res,"\n\n";
47
48$res = html_entity_decode("&#x8F;", ENT_QUOTES, 'WINDOWS-1252');
49echo "Special test for &#x8F; (shouldn't decode):\n";
50echo $res,"\n\n";
51
52$res = html_entity_decode("&#x90;", ENT_QUOTES, 'WINDOWS-1252');
53echo "Special test for &#x90; (shouldn't decode):\n";
54echo $res,"\n\n";
55
56$res = html_entity_decode("&#x9D;", ENT_QUOTES, 'WINDOWS-1252');
57echo "Special test for &#x9D; (shouldn't decode):\n";
58echo $res,"\n\n";
59
60foreach ($arr as $u => $v) {
61    $ent = sprintf("&#x%X;", $u);
62    $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252');
63    $d = unpack("H*", $res);
64    echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
65
66    $ent = sprintf("&#x%X;", $v[0]);
67    $res = html_entity_decode($ent, ENT_QUOTES, 'WINDOWS-1252');
68    if ($res[0] != "&" || $res[1] != "#")
69        $res = unpack("H*", $res)[1];
70    echo sprintf("%s => %s\n\n", $ent, $res);
71}
72?>
73--EXPECT--
74Special test for &#x81; (shouldn't decode):
75&#x81;
76
77Special test for &#x8D; (shouldn't decode):
78&#x8D;
79
80Special test for &#x8F; (shouldn't decode):
81&#x8F;
82
83Special test for &#x90; (shouldn't decode):
84&#x90;
85
86Special test for &#x9D; (shouldn't decode):
87&#x9D;
88
89EURO SIGN: &#x20AC; => 80
90&#x80; => &#x80;
91
92SINGLE LOW-9 QUOTATION MARK: &#x201A; => 82
93&#x82; => &#x82;
94
95LATIN SMALL LETTER F WITH HOOK: &#x192; => 83
96&#x83; => &#x83;
97
98DOUBLE LOW-9 QUOTATION MARK: &#x201E; => 84
99&#x84; => &#x84;
100
101HORIZONTAL ELLIPSIS: &#x2026; => 85
102&#x85; => &#x85;
103
104DAGGER: &#x2020; => 86
105&#x86; => &#x86;
106
107DOUBLE DAGGER: &#x2021; => 87
108&#x87; => &#x87;
109
110MODIFIER LETTER CIRCUMFLEX ACCENT: &#x2C6; => 88
111&#x88; => &#x88;
112
113PER MILLE SIGN: &#x2030; => 89
114&#x89; => &#x89;
115
116LATIN CAPITAL LETTER S WITH CARON: &#x160; => 8a
117&#x8A; => &#x8A;
118
119SINGLE LEFT-POINTING ANGLE QUOTATION MARK: &#x2039; => 8b
120&#x8B; => &#x8B;
121
122LATIN CAPITAL LIGATURE OE: &#x152; => 8c
123&#x8C; => &#x8C;
124
125LATIN CAPITAL LETTER Z WITH CARON: &#x17D; => 8e
126&#x8E; => &#x8E;
127
128LEFT SINGLE QUOTATION MARK: &#x2018; => 91
129&#x91; => &#x91;
130
131RIGHT SINGLE QUOTATION MARK: &#x2019; => 92
132&#x92; => &#x92;
133
134LEFT DOUBLE QUOTATION MARK: &#x201C; => 93
135&#x93; => &#x93;
136
137RIGHT DOUBLE QUOTATION MARK: &#x201D; => 94
138&#x94; => &#x94;
139
140BULLET: &#x2022; => 95
141&#x95; => &#x95;
142
143EN DASH: &#x2013; => 96
144&#x96; => &#x96;
145
146EM DASH: &#x2014; => 97
147&#x97; => &#x97;
148
149SMALL TILDE: &#x2DC; => 98
150&#x98; => &#x98;
151
152TRADE MARK SIGN: &#x2122; => 99
153&#x99; => &#x99;
154
155LATIN SMALL LETTER S WITH CARON: &#x161; => 9a
156&#x9A; => &#x9A;
157
158SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: &#x203A; => 9b
159&#x9B; => &#x9B;
160
161LATIN SMALL LIGATURE OE: &#x153; => 9c
162&#x9C; => &#x9C;
163
164LATIN SMALL LETTER Z WITH CARON: &#x17E; => 9e
165&#x9E; => &#x9E;
166
167LATIN CAPITAL LETTER Y WITH DIAERESIS: &#x178; => 9f
168&#x9F; => &#x9F;
169