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--EXPECT--
73Special test for &#x81; (shouldn't decode):
74&#x81;
75
76Special test for &#x8D; (shouldn't decode):
77&#x8D;
78
79Special test for &#x8F; (shouldn't decode):
80&#x8F;
81
82Special test for &#x90; (shouldn't decode):
83&#x90;
84
85Special test for &#x9D; (shouldn't decode):
86&#x9D;
87
88EURO SIGN: &#x20AC; => 80
89&#x80; => &#x80;
90
91SINGLE LOW-9 QUOTATION MARK: &#x201A; => 82
92&#x82; => &#x82;
93
94LATIN SMALL LETTER F WITH HOOK: &#x192; => 83
95&#x83; => &#x83;
96
97DOUBLE LOW-9 QUOTATION MARK: &#x201E; => 84
98&#x84; => &#x84;
99
100HORIZONTAL ELLIPSIS: &#x2026; => 85
101&#x85; => &#x85;
102
103DAGGER: &#x2020; => 86
104&#x86; => &#x86;
105
106DOUBLE DAGGER: &#x2021; => 87
107&#x87; => &#x87;
108
109MODIFIER LETTER CIRCUMFLEX ACCENT: &#x2C6; => 88
110&#x88; => &#x88;
111
112PER MILLE SIGN: &#x2030; => 89
113&#x89; => &#x89;
114
115LATIN CAPITAL LETTER S WITH CARON: &#x160; => 8a
116&#x8A; => &#x8A;
117
118SINGLE LEFT-POINTING ANGLE QUOTATION MARK: &#x2039; => 8b
119&#x8B; => &#x8B;
120
121LATIN CAPITAL LIGATURE OE: &#x152; => 8c
122&#x8C; => &#x8C;
123
124LATIN CAPITAL LETTER Z WITH CARON: &#x17D; => 8e
125&#x8E; => &#x8E;
126
127LEFT SINGLE QUOTATION MARK: &#x2018; => 91
128&#x91; => &#x91;
129
130RIGHT SINGLE QUOTATION MARK: &#x2019; => 92
131&#x92; => &#x92;
132
133LEFT DOUBLE QUOTATION MARK: &#x201C; => 93
134&#x93; => &#x93;
135
136RIGHT DOUBLE QUOTATION MARK: &#x201D; => 94
137&#x94; => &#x94;
138
139BULLET: &#x2022; => 95
140&#x95; => &#x95;
141
142EN DASH: &#x2013; => 96
143&#x96; => &#x96;
144
145EM DASH: &#x2014; => 97
146&#x97; => &#x97;
147
148SMALL TILDE: &#x2DC; => 98
149&#x98; => &#x98;
150
151TRADE MARK SIGN: &#x2122; => 99
152&#x99; => &#x99;
153
154LATIN SMALL LETTER S WITH CARON: &#x161; => 9a
155&#x9A; => &#x9A;
156
157SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: &#x203A; => 9b
158&#x9B; => &#x9B;
159
160LATIN SMALL LIGATURE OE: &#x153; => 9c
161&#x9C; => &#x9C;
162
163LATIN SMALL LETTER Z WITH CARON: &#x17E; => 9e
164&#x9E; => &#x9E;
165
166LATIN CAPITAL LETTER Y WITH DIAERESIS: &#x178; => 9f
167&#x9F; => &#x9F;
168
169
170