1--TEST--
2Translation of HTML entities for encoding ISO-8859-15
3--FILE--
4<?php
5$arr = array(
60x00A0 => array(0xA0, "NO-BREAK SPACE"),
70x00A1 => array(0xA1, "INVERTED EXCLAMATION MARK"),
80x00A2 => array(0xA2, "CENT SIGN"),
90x00A3 => array(0xA3, "POUND SIGN"),
100x20AC => array(0xA4, "EURO SIGN"),
110x00A5 => array(0xA5, "YEN SIGN"),
120x0160 => array(0xA6, "LATIN CAPITAL LETTER S WITH CARON"),
130x00A7 => array(0xA7, "SECTION SIGN"),
140x0161 => array(0xA8, "LATIN SMALL LETTER S WITH CARON"),
150x00A9 => array(0xA9, "COPYRIGHT SIGN"),
160x00AA => array(0xAA, "FEMININE ORDINAL INDICATOR"),
170x00AB => array(0xAB, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"),
180x00AC => array(0xAC, "NOT SIGN"),
190x00AD => array(0xAD, "SOFT HYPHEN"),
200x00AE => array(0xAE, "REGISTERED SIGN"),
210x00AF => array(0xAF, "MACRON"),
220x00B0 => array(0xB0, "DEGREE SIGN"),
230x00B1 => array(0xB1, "PLUS-MINUS SIGN"),
240x00B2 => array(0xB2, "SUPERSCRIPT TWO"),
250x00B3 => array(0xB3, "SUPERSCRIPT THREE"),
260x017D => array(0xB4, "LATIN CAPITAL LETTER Z WITH CARON"),
270x00B5 => array(0xB5, "MICRO SIGN"),
280x00B6 => array(0xB6, "PILCROW SIGN"),
290x00B7 => array(0xB7, "MIDDLE DOT"),
300x017E => array(0xB8, "LATIN SMALL LETTER Z WITH CARON"),
310x00B9 => array(0xB9, "SUPERSCRIPT ONE"),
320x00BA => array(0xBA, "MASCULINE ORDINAL INDICATOR"),
330x00BB => array(0xBB, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"),
340x0152 => array(0xBC, "LATIN CAPITAL LIGATURE OE"),
350x0153 => array(0xBD, "LATIN SMALL LIGATURE OE"),
360x0178 => array(0xBE, "LATIN CAPITAL LETTER Y WITH DIAERESIS"),
370x00BF => array(0xBF, "INVERTED QUESTION MARK"),
380x00C0 => array(0xC0, "LATIN CAPITAL LETTER A WITH GRAVE"),
390x00C1 => array(0xC1, "LATIN CAPITAL LETTER A WITH ACUTE"),
400x00C2 => array(0xC2, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"),
410x00C3 => array(0xC3, "LATIN CAPITAL LETTER A WITH TILDE"),
420x00C4 => array(0xC4, "LATIN CAPITAL LETTER A WITH DIAERESIS"),
430x00C5 => array(0xC5, "LATIN CAPITAL LETTER A WITH RING ABOVE"),
440x00C6 => array(0xC6, "LATIN CAPITAL LETTER AE"),
450x00C7 => array(0xC7, "LATIN CAPITAL LETTER C WITH CEDILLA"),
460x00C8 => array(0xC8, "LATIN CAPITAL LETTER E WITH GRAVE"),
470x00C9 => array(0xC9, "LATIN CAPITAL LETTER E WITH ACUTE"),
480x00CA => array(0xCA, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"),
490x00CB => array(0xCB, "LATIN CAPITAL LETTER E WITH DIAERESIS"),
500x00CC => array(0xCC, "LATIN CAPITAL LETTER I WITH GRAVE"),
510x00CD => array(0xCD, "LATIN CAPITAL LETTER I WITH ACUTE"),
520x00CE => array(0xCE, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"),
530x00CF => array(0xCF, "LATIN CAPITAL LETTER I WITH DIAERESIS"),
540x00D0 => array(0xD0, "LATIN CAPITAL LETTER ETH"),
550x00D1 => array(0xD1, "LATIN CAPITAL LETTER N WITH TILDE"),
560x00D2 => array(0xD2, "LATIN CAPITAL LETTER O WITH GRAVE"),
570x00D3 => array(0xD3, "LATIN CAPITAL LETTER O WITH ACUTE"),
580x00D4 => array(0xD4, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"),
590x00D5 => array(0xD5, "LATIN CAPITAL LETTER O WITH TILDE"),
600x00D6 => array(0xD6, "LATIN CAPITAL LETTER O WITH DIAERESIS"),
610x00D7 => array(0xD7, "MULTIPLICATION SIGN"),
620x00D8 => array(0xD8, "LATIN CAPITAL LETTER O WITH STROKE"),
630x00D9 => array(0xD9, "LATIN CAPITAL LETTER U WITH GRAVE"),
640x00DA => array(0xDA, "LATIN CAPITAL LETTER U WITH ACUTE"),
650x00DB => array(0xDB, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"),
660x00DC => array(0xDC, "LATIN CAPITAL LETTER U WITH DIAERESIS"),
670x00DD => array(0xDD, "LATIN CAPITAL LETTER Y WITH ACUTE"),
680x00DE => array(0xDE, "LATIN CAPITAL LETTER THORN"),
690x00DF => array(0xDF, "LATIN SMALL LETTER SHARP S"),
700x00E0 => array(0xE0, "LATIN SMALL LETTER A WITH GRAVE"),
710x00E1 => array(0xE1, "LATIN SMALL LETTER A WITH ACUTE"),
720x00E2 => array(0xE2, "LATIN SMALL LETTER A WITH CIRCUMFLEX"),
730x00E3 => array(0xE3, "LATIN SMALL LETTER A WITH TILDE"),
740x00E4 => array(0xE4, "LATIN SMALL LETTER A WITH DIAERESIS"),
750x00E5 => array(0xE5, "LATIN SMALL LETTER A WITH RING ABOVE"),
760x00E6 => array(0xE6, "LATIN SMALL LETTER AE"),
770x00E7 => array(0xE7, "LATIN SMALL LETTER C WITH CEDILLA"),
780x00E8 => array(0xE8, "LATIN SMALL LETTER E WITH GRAVE"),
790x00E9 => array(0xE9, "LATIN SMALL LETTER E WITH ACUTE"),
800x00EA => array(0xEA, "LATIN SMALL LETTER E WITH CIRCUMFLEX"),
810x00EB => array(0xEB, "LATIN SMALL LETTER E WITH DIAERESIS"),
820x00EC => array(0xEC, "LATIN SMALL LETTER I WITH GRAVE"),
830x00ED => array(0xED, "LATIN SMALL LETTER I WITH ACUTE"),
840x00EE => array(0xEE, "LATIN SMALL LETTER I WITH CIRCUMFLEX"),
850x00EF => array(0xEF, "LATIN SMALL LETTER I WITH DIAERESIS"),
860x00F0 => array(0xF0, "LATIN SMALL LETTER ETH"),
870x00F1 => array(0xF1, "LATIN SMALL LETTER N WITH TILDE"),
880x00F2 => array(0xF2, "LATIN SMALL LETTER O WITH GRAVE"),
890x00F3 => array(0xF3, "LATIN SMALL LETTER O WITH ACUTE"),
900x00F4 => array(0xF4, "LATIN SMALL LETTER O WITH CIRCUMFLEX"),
910x00F5 => array(0xF5, "LATIN SMALL LETTER O WITH TILDE"),
920x00F6 => array(0xF6, "LATIN SMALL LETTER O WITH DIAERESIS"),
930x00F7 => array(0xF7, "DIVISION SIGN"),
940x00F8 => array(0xF8, "LATIN SMALL LETTER O WITH STROKE"),
950x00F9 => array(0xF9, "LATIN SMALL LETTER U WITH GRAVE"),
960x00FA => array(0xFA, "LATIN SMALL LETTER U WITH ACUTE"),
970x00FB => array(0xFB, "LATIN SMALL LETTER U WITH CIRCUMFLEX"),
980x00FC => array(0xFC, "LATIN SMALL LETTER U WITH DIAERESIS"),
990x00FD => array(0xFD, "LATIN SMALL LETTER Y WITH ACUTE"),
1000x00FE => array(0xFE, "LATIN SMALL LETTER THORN"),
1010x00FF => array(0xFF, "LATIN SMALL LETTER Y WITH DIAERESIS"),
102);
103
104foreach ($arr as $u => $v) {
105    $ent = sprintf("&#x%X;", $u);
106    $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-15');
107    $d = unpack("H*", $res);
108    echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]);
109
110    $ent = sprintf("&#x%X;", $v[0]);
111    $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-15');
112    if ($res[0] != "&" || $res[1] != "#")
113        $res = unpack("H*", $res)[1];
114    echo sprintf("%s => %s\n\n", $ent, $res);
115}
116?>
117--EXPECT--
118NO-BREAK SPACE: &#xA0; => a0
119&#xA0; => a0
120
121INVERTED EXCLAMATION MARK: &#xA1; => a1
122&#xA1; => a1
123
124CENT SIGN: &#xA2; => a2
125&#xA2; => a2
126
127POUND SIGN: &#xA3; => a3
128&#xA3; => a3
129
130EURO SIGN: &#x20AC; => a4
131&#xA4; => &#xA4;
132
133YEN SIGN: &#xA5; => a5
134&#xA5; => a5
135
136LATIN CAPITAL LETTER S WITH CARON: &#x160; => a6
137&#xA6; => &#xA6;
138
139SECTION SIGN: &#xA7; => a7
140&#xA7; => a7
141
142LATIN SMALL LETTER S WITH CARON: &#x161; => a8
143&#xA8; => &#xA8;
144
145COPYRIGHT SIGN: &#xA9; => a9
146&#xA9; => a9
147
148FEMININE ORDINAL INDICATOR: &#xAA; => aa
149&#xAA; => aa
150
151LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xAB; => ab
152&#xAB; => ab
153
154NOT SIGN: &#xAC; => ac
155&#xAC; => ac
156
157SOFT HYPHEN: &#xAD; => ad
158&#xAD; => ad
159
160REGISTERED SIGN: &#xAE; => ae
161&#xAE; => ae
162
163MACRON: &#xAF; => af
164&#xAF; => af
165
166DEGREE SIGN: &#xB0; => b0
167&#xB0; => b0
168
169PLUS-MINUS SIGN: &#xB1; => b1
170&#xB1; => b1
171
172SUPERSCRIPT TWO: &#xB2; => b2
173&#xB2; => b2
174
175SUPERSCRIPT THREE: &#xB3; => b3
176&#xB3; => b3
177
178LATIN CAPITAL LETTER Z WITH CARON: &#x17D; => b4
179&#xB4; => &#xB4;
180
181MICRO SIGN: &#xB5; => b5
182&#xB5; => b5
183
184PILCROW SIGN: &#xB6; => b6
185&#xB6; => b6
186
187MIDDLE DOT: &#xB7; => b7
188&#xB7; => b7
189
190LATIN SMALL LETTER Z WITH CARON: &#x17E; => b8
191&#xB8; => &#xB8;
192
193SUPERSCRIPT ONE: &#xB9; => b9
194&#xB9; => b9
195
196MASCULINE ORDINAL INDICATOR: &#xBA; => ba
197&#xBA; => ba
198
199RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xBB; => bb
200&#xBB; => bb
201
202LATIN CAPITAL LIGATURE OE: &#x152; => bc
203&#xBC; => &#xBC;
204
205LATIN SMALL LIGATURE OE: &#x153; => bd
206&#xBD; => &#xBD;
207
208LATIN CAPITAL LETTER Y WITH DIAERESIS: &#x178; => be
209&#xBE; => &#xBE;
210
211INVERTED QUESTION MARK: &#xBF; => bf
212&#xBF; => bf
213
214LATIN CAPITAL LETTER A WITH GRAVE: &#xC0; => c0
215&#xC0; => c0
216
217LATIN CAPITAL LETTER A WITH ACUTE: &#xC1; => c1
218&#xC1; => c1
219
220LATIN CAPITAL LETTER A WITH CIRCUMFLEX: &#xC2; => c2
221&#xC2; => c2
222
223LATIN CAPITAL LETTER A WITH TILDE: &#xC3; => c3
224&#xC3; => c3
225
226LATIN CAPITAL LETTER A WITH DIAERESIS: &#xC4; => c4
227&#xC4; => c4
228
229LATIN CAPITAL LETTER A WITH RING ABOVE: &#xC5; => c5
230&#xC5; => c5
231
232LATIN CAPITAL LETTER AE: &#xC6; => c6
233&#xC6; => c6
234
235LATIN CAPITAL LETTER C WITH CEDILLA: &#xC7; => c7
236&#xC7; => c7
237
238LATIN CAPITAL LETTER E WITH GRAVE: &#xC8; => c8
239&#xC8; => c8
240
241LATIN CAPITAL LETTER E WITH ACUTE: &#xC9; => c9
242&#xC9; => c9
243
244LATIN CAPITAL LETTER E WITH CIRCUMFLEX: &#xCA; => ca
245&#xCA; => ca
246
247LATIN CAPITAL LETTER E WITH DIAERESIS: &#xCB; => cb
248&#xCB; => cb
249
250LATIN CAPITAL LETTER I WITH GRAVE: &#xCC; => cc
251&#xCC; => cc
252
253LATIN CAPITAL LETTER I WITH ACUTE: &#xCD; => cd
254&#xCD; => cd
255
256LATIN CAPITAL LETTER I WITH CIRCUMFLEX: &#xCE; => ce
257&#xCE; => ce
258
259LATIN CAPITAL LETTER I WITH DIAERESIS: &#xCF; => cf
260&#xCF; => cf
261
262LATIN CAPITAL LETTER ETH: &#xD0; => d0
263&#xD0; => d0
264
265LATIN CAPITAL LETTER N WITH TILDE: &#xD1; => d1
266&#xD1; => d1
267
268LATIN CAPITAL LETTER O WITH GRAVE: &#xD2; => d2
269&#xD2; => d2
270
271LATIN CAPITAL LETTER O WITH ACUTE: &#xD3; => d3
272&#xD3; => d3
273
274LATIN CAPITAL LETTER O WITH CIRCUMFLEX: &#xD4; => d4
275&#xD4; => d4
276
277LATIN CAPITAL LETTER O WITH TILDE: &#xD5; => d5
278&#xD5; => d5
279
280LATIN CAPITAL LETTER O WITH DIAERESIS: &#xD6; => d6
281&#xD6; => d6
282
283MULTIPLICATION SIGN: &#xD7; => d7
284&#xD7; => d7
285
286LATIN CAPITAL LETTER O WITH STROKE: &#xD8; => d8
287&#xD8; => d8
288
289LATIN CAPITAL LETTER U WITH GRAVE: &#xD9; => d9
290&#xD9; => d9
291
292LATIN CAPITAL LETTER U WITH ACUTE: &#xDA; => da
293&#xDA; => da
294
295LATIN CAPITAL LETTER U WITH CIRCUMFLEX: &#xDB; => db
296&#xDB; => db
297
298LATIN CAPITAL LETTER U WITH DIAERESIS: &#xDC; => dc
299&#xDC; => dc
300
301LATIN CAPITAL LETTER Y WITH ACUTE: &#xDD; => dd
302&#xDD; => dd
303
304LATIN CAPITAL LETTER THORN: &#xDE; => de
305&#xDE; => de
306
307LATIN SMALL LETTER SHARP S: &#xDF; => df
308&#xDF; => df
309
310LATIN SMALL LETTER A WITH GRAVE: &#xE0; => e0
311&#xE0; => e0
312
313LATIN SMALL LETTER A WITH ACUTE: &#xE1; => e1
314&#xE1; => e1
315
316LATIN SMALL LETTER A WITH CIRCUMFLEX: &#xE2; => e2
317&#xE2; => e2
318
319LATIN SMALL LETTER A WITH TILDE: &#xE3; => e3
320&#xE3; => e3
321
322LATIN SMALL LETTER A WITH DIAERESIS: &#xE4; => e4
323&#xE4; => e4
324
325LATIN SMALL LETTER A WITH RING ABOVE: &#xE5; => e5
326&#xE5; => e5
327
328LATIN SMALL LETTER AE: &#xE6; => e6
329&#xE6; => e6
330
331LATIN SMALL LETTER C WITH CEDILLA: &#xE7; => e7
332&#xE7; => e7
333
334LATIN SMALL LETTER E WITH GRAVE: &#xE8; => e8
335&#xE8; => e8
336
337LATIN SMALL LETTER E WITH ACUTE: &#xE9; => e9
338&#xE9; => e9
339
340LATIN SMALL LETTER E WITH CIRCUMFLEX: &#xEA; => ea
341&#xEA; => ea
342
343LATIN SMALL LETTER E WITH DIAERESIS: &#xEB; => eb
344&#xEB; => eb
345
346LATIN SMALL LETTER I WITH GRAVE: &#xEC; => ec
347&#xEC; => ec
348
349LATIN SMALL LETTER I WITH ACUTE: &#xED; => ed
350&#xED; => ed
351
352LATIN SMALL LETTER I WITH CIRCUMFLEX: &#xEE; => ee
353&#xEE; => ee
354
355LATIN SMALL LETTER I WITH DIAERESIS: &#xEF; => ef
356&#xEF; => ef
357
358LATIN SMALL LETTER ETH: &#xF0; => f0
359&#xF0; => f0
360
361LATIN SMALL LETTER N WITH TILDE: &#xF1; => f1
362&#xF1; => f1
363
364LATIN SMALL LETTER O WITH GRAVE: &#xF2; => f2
365&#xF2; => f2
366
367LATIN SMALL LETTER O WITH ACUTE: &#xF3; => f3
368&#xF3; => f3
369
370LATIN SMALL LETTER O WITH CIRCUMFLEX: &#xF4; => f4
371&#xF4; => f4
372
373LATIN SMALL LETTER O WITH TILDE: &#xF5; => f5
374&#xF5; => f5
375
376LATIN SMALL LETTER O WITH DIAERESIS: &#xF6; => f6
377&#xF6; => f6
378
379DIVISION SIGN: &#xF7; => f7
380&#xF7; => f7
381
382LATIN SMALL LETTER O WITH STROKE: &#xF8; => f8
383&#xF8; => f8
384
385LATIN SMALL LETTER U WITH GRAVE: &#xF9; => f9
386&#xF9; => f9
387
388LATIN SMALL LETTER U WITH ACUTE: &#xFA; => fa
389&#xFA; => fa
390
391LATIN SMALL LETTER U WITH CIRCUMFLEX: &#xFB; => fb
392&#xFB; => fb
393
394LATIN SMALL LETTER U WITH DIAERESIS: &#xFC; => fc
395&#xFC; => fc
396
397LATIN SMALL LETTER Y WITH ACUTE: &#xFD; => fd
398&#xFD; => fd
399
400LATIN SMALL LETTER THORN: &#xFE; => fe
401&#xFE; => fe
402
403LATIN SMALL LETTER Y WITH DIAERESIS: &#xFF; => ff
404&#xFF; => ff
405