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--EXPECT--
117NO-BREAK SPACE: &#xA0; => a0
118&#xA0; => a0
119
120INVERTED EXCLAMATION MARK: &#xA1; => a1
121&#xA1; => a1
122
123CENT SIGN: &#xA2; => a2
124&#xA2; => a2
125
126POUND SIGN: &#xA3; => a3
127&#xA3; => a3
128
129EURO SIGN: &#x20AC; => a4
130&#xA4; => &#xA4;
131
132YEN SIGN: &#xA5; => a5
133&#xA5; => a5
134
135LATIN CAPITAL LETTER S WITH CARON: &#x160; => a6
136&#xA6; => &#xA6;
137
138SECTION SIGN: &#xA7; => a7
139&#xA7; => a7
140
141LATIN SMALL LETTER S WITH CARON: &#x161; => a8
142&#xA8; => &#xA8;
143
144COPYRIGHT SIGN: &#xA9; => a9
145&#xA9; => a9
146
147FEMININE ORDINAL INDICATOR: &#xAA; => aa
148&#xAA; => aa
149
150LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xAB; => ab
151&#xAB; => ab
152
153NOT SIGN: &#xAC; => ac
154&#xAC; => ac
155
156SOFT HYPHEN: &#xAD; => ad
157&#xAD; => ad
158
159REGISTERED SIGN: &#xAE; => ae
160&#xAE; => ae
161
162MACRON: &#xAF; => af
163&#xAF; => af
164
165DEGREE SIGN: &#xB0; => b0
166&#xB0; => b0
167
168PLUS-MINUS SIGN: &#xB1; => b1
169&#xB1; => b1
170
171SUPERSCRIPT TWO: &#xB2; => b2
172&#xB2; => b2
173
174SUPERSCRIPT THREE: &#xB3; => b3
175&#xB3; => b3
176
177LATIN CAPITAL LETTER Z WITH CARON: &#x17D; => b4
178&#xB4; => &#xB4;
179
180MICRO SIGN: &#xB5; => b5
181&#xB5; => b5
182
183PILCROW SIGN: &#xB6; => b6
184&#xB6; => b6
185
186MIDDLE DOT: &#xB7; => b7
187&#xB7; => b7
188
189LATIN SMALL LETTER Z WITH CARON: &#x17E; => b8
190&#xB8; => &#xB8;
191
192SUPERSCRIPT ONE: &#xB9; => b9
193&#xB9; => b9
194
195MASCULINE ORDINAL INDICATOR: &#xBA; => ba
196&#xBA; => ba
197
198RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: &#xBB; => bb
199&#xBB; => bb
200
201LATIN CAPITAL LIGATURE OE: &#x152; => bc
202&#xBC; => &#xBC;
203
204LATIN SMALL LIGATURE OE: &#x153; => bd
205&#xBD; => &#xBD;
206
207LATIN CAPITAL LETTER Y WITH DIAERESIS: &#x178; => be
208&#xBE; => &#xBE;
209
210INVERTED QUESTION MARK: &#xBF; => bf
211&#xBF; => bf
212
213LATIN CAPITAL LETTER A WITH GRAVE: &#xC0; => c0
214&#xC0; => c0
215
216LATIN CAPITAL LETTER A WITH ACUTE: &#xC1; => c1
217&#xC1; => c1
218
219LATIN CAPITAL LETTER A WITH CIRCUMFLEX: &#xC2; => c2
220&#xC2; => c2
221
222LATIN CAPITAL LETTER A WITH TILDE: &#xC3; => c3
223&#xC3; => c3
224
225LATIN CAPITAL LETTER A WITH DIAERESIS: &#xC4; => c4
226&#xC4; => c4
227
228LATIN CAPITAL LETTER A WITH RING ABOVE: &#xC5; => c5
229&#xC5; => c5
230
231LATIN CAPITAL LETTER AE: &#xC6; => c6
232&#xC6; => c6
233
234LATIN CAPITAL LETTER C WITH CEDILLA: &#xC7; => c7
235&#xC7; => c7
236
237LATIN CAPITAL LETTER E WITH GRAVE: &#xC8; => c8
238&#xC8; => c8
239
240LATIN CAPITAL LETTER E WITH ACUTE: &#xC9; => c9
241&#xC9; => c9
242
243LATIN CAPITAL LETTER E WITH CIRCUMFLEX: &#xCA; => ca
244&#xCA; => ca
245
246LATIN CAPITAL LETTER E WITH DIAERESIS: &#xCB; => cb
247&#xCB; => cb
248
249LATIN CAPITAL LETTER I WITH GRAVE: &#xCC; => cc
250&#xCC; => cc
251
252LATIN CAPITAL LETTER I WITH ACUTE: &#xCD; => cd
253&#xCD; => cd
254
255LATIN CAPITAL LETTER I WITH CIRCUMFLEX: &#xCE; => ce
256&#xCE; => ce
257
258LATIN CAPITAL LETTER I WITH DIAERESIS: &#xCF; => cf
259&#xCF; => cf
260
261LATIN CAPITAL LETTER ETH: &#xD0; => d0
262&#xD0; => d0
263
264LATIN CAPITAL LETTER N WITH TILDE: &#xD1; => d1
265&#xD1; => d1
266
267LATIN CAPITAL LETTER O WITH GRAVE: &#xD2; => d2
268&#xD2; => d2
269
270LATIN CAPITAL LETTER O WITH ACUTE: &#xD3; => d3
271&#xD3; => d3
272
273LATIN CAPITAL LETTER O WITH CIRCUMFLEX: &#xD4; => d4
274&#xD4; => d4
275
276LATIN CAPITAL LETTER O WITH TILDE: &#xD5; => d5
277&#xD5; => d5
278
279LATIN CAPITAL LETTER O WITH DIAERESIS: &#xD6; => d6
280&#xD6; => d6
281
282MULTIPLICATION SIGN: &#xD7; => d7
283&#xD7; => d7
284
285LATIN CAPITAL LETTER O WITH STROKE: &#xD8; => d8
286&#xD8; => d8
287
288LATIN CAPITAL LETTER U WITH GRAVE: &#xD9; => d9
289&#xD9; => d9
290
291LATIN CAPITAL LETTER U WITH ACUTE: &#xDA; => da
292&#xDA; => da
293
294LATIN CAPITAL LETTER U WITH CIRCUMFLEX: &#xDB; => db
295&#xDB; => db
296
297LATIN CAPITAL LETTER U WITH DIAERESIS: &#xDC; => dc
298&#xDC; => dc
299
300LATIN CAPITAL LETTER Y WITH ACUTE: &#xDD; => dd
301&#xDD; => dd
302
303LATIN CAPITAL LETTER THORN: &#xDE; => de
304&#xDE; => de
305
306LATIN SMALL LETTER SHARP S: &#xDF; => df
307&#xDF; => df
308
309LATIN SMALL LETTER A WITH GRAVE: &#xE0; => e0
310&#xE0; => e0
311
312LATIN SMALL LETTER A WITH ACUTE: &#xE1; => e1
313&#xE1; => e1
314
315LATIN SMALL LETTER A WITH CIRCUMFLEX: &#xE2; => e2
316&#xE2; => e2
317
318LATIN SMALL LETTER A WITH TILDE: &#xE3; => e3
319&#xE3; => e3
320
321LATIN SMALL LETTER A WITH DIAERESIS: &#xE4; => e4
322&#xE4; => e4
323
324LATIN SMALL LETTER A WITH RING ABOVE: &#xE5; => e5
325&#xE5; => e5
326
327LATIN SMALL LETTER AE: &#xE6; => e6
328&#xE6; => e6
329
330LATIN SMALL LETTER C WITH CEDILLA: &#xE7; => e7
331&#xE7; => e7
332
333LATIN SMALL LETTER E WITH GRAVE: &#xE8; => e8
334&#xE8; => e8
335
336LATIN SMALL LETTER E WITH ACUTE: &#xE9; => e9
337&#xE9; => e9
338
339LATIN SMALL LETTER E WITH CIRCUMFLEX: &#xEA; => ea
340&#xEA; => ea
341
342LATIN SMALL LETTER E WITH DIAERESIS: &#xEB; => eb
343&#xEB; => eb
344
345LATIN SMALL LETTER I WITH GRAVE: &#xEC; => ec
346&#xEC; => ec
347
348LATIN SMALL LETTER I WITH ACUTE: &#xED; => ed
349&#xED; => ed
350
351LATIN SMALL LETTER I WITH CIRCUMFLEX: &#xEE; => ee
352&#xEE; => ee
353
354LATIN SMALL LETTER I WITH DIAERESIS: &#xEF; => ef
355&#xEF; => ef
356
357LATIN SMALL LETTER ETH: &#xF0; => f0
358&#xF0; => f0
359
360LATIN SMALL LETTER N WITH TILDE: &#xF1; => f1
361&#xF1; => f1
362
363LATIN SMALL LETTER O WITH GRAVE: &#xF2; => f2
364&#xF2; => f2
365
366LATIN SMALL LETTER O WITH ACUTE: &#xF3; => f3
367&#xF3; => f3
368
369LATIN SMALL LETTER O WITH CIRCUMFLEX: &#xF4; => f4
370&#xF4; => f4
371
372LATIN SMALL LETTER O WITH TILDE: &#xF5; => f5
373&#xF5; => f5
374
375LATIN SMALL LETTER O WITH DIAERESIS: &#xF6; => f6
376&#xF6; => f6
377
378DIVISION SIGN: &#xF7; => f7
379&#xF7; => f7
380
381LATIN SMALL LETTER O WITH STROKE: &#xF8; => f8
382&#xF8; => f8
383
384LATIN SMALL LETTER U WITH GRAVE: &#xF9; => f9
385&#xF9; => f9
386
387LATIN SMALL LETTER U WITH ACUTE: &#xFA; => fa
388&#xFA; => fa
389
390LATIN SMALL LETTER U WITH CIRCUMFLEX: &#xFB; => fb
391&#xFB; => fb
392
393LATIN SMALL LETTER U WITH DIAERESIS: &#xFC; => fc
394&#xFC; => fc
395
396LATIN SMALL LETTER Y WITH ACUTE: &#xFD; => fd
397&#xFD; => fd
398
399LATIN SMALL LETTER THORN: &#xFE; => fe
400&#xFE; => fe
401
402LATIN SMALL LETTER Y WITH DIAERESIS: &#xFF; => ff
403&#xFF; => ff
404
405
406