1--TEST--
2Translation of HTML entities for encoding ISO-8859-5
3--FILE--
4<?php
5$arr = array(
60x00A0 => array(0xA0, "NO-BREAK SPACE"),
70x0401 => array(0xA1, "CYRILLIC CAPITAL LETTER IO"),
80x0402 => array(0xA2, "CYRILLIC CAPITAL LETTER DJE"),
90x0403 => array(0xA3, "CYRILLIC CAPITAL LETTER GJE"),
100x0404 => array(0xA4, "CYRILLIC CAPITAL LETTER UKRAINIAN IE"),
110x0405 => array(0xA5, "CYRILLIC CAPITAL LETTER DZE"),
120x0406 => array(0xA6, "CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I"),
130x0407 => array(0xA7, "CYRILLIC CAPITAL LETTER YI"),
140x0408 => array(0xA8, "CYRILLIC CAPITAL LETTER JE"),
150x0409 => array(0xA9, "CYRILLIC CAPITAL LETTER LJE"),
160x040A => array(0xAA, "CYRILLIC CAPITAL LETTER NJE"),
170x040B => array(0xAB, "CYRILLIC CAPITAL LETTER TSHE"),
180x040C => array(0xAC, "CYRILLIC CAPITAL LETTER KJE"),
190x00AD => array(0xAD, "SOFT HYPHEN"),
200x040E => array(0xAE, "CYRILLIC CAPITAL LETTER SHORT U"),
210x040F => array(0xAF, "CYRILLIC CAPITAL LETTER DZHE"),
220x0410 => array(0xB0, "CYRILLIC CAPITAL LETTER A"),
230x0411 => array(0xB1, "CYRILLIC CAPITAL LETTER BE"),
240x0412 => array(0xB2, "CYRILLIC CAPITAL LETTER VE"),
250x0413 => array(0xB3, "CYRILLIC CAPITAL LETTER GHE"),
260x0414 => array(0xB4, "CYRILLIC CAPITAL LETTER DE"),
270x0415 => array(0xB5, "CYRILLIC CAPITAL LETTER IE"),
280x0416 => array(0xB6, "CYRILLIC CAPITAL LETTER ZHE"),
290x0417 => array(0xB7, "CYRILLIC CAPITAL LETTER ZE"),
300x0418 => array(0xB8, "CYRILLIC CAPITAL LETTER I"),
310x0419 => array(0xB9, "CYRILLIC CAPITAL LETTER SHORT I"),
320x041A => array(0xBA, "CYRILLIC CAPITAL LETTER KA"),
330x041B => array(0xBB, "CYRILLIC CAPITAL LETTER EL"),
340x041C => array(0xBC, "CYRILLIC CAPITAL LETTER EM"),
350x041D => array(0xBD, "CYRILLIC CAPITAL LETTER EN"),
360x041E => array(0xBE, "CYRILLIC CAPITAL LETTER O"),
370x041F => array(0xBF, "CYRILLIC CAPITAL LETTER PE"),
380x0420 => array(0xC0, "CYRILLIC CAPITAL LETTER ER"),
390x0421 => array(0xC1, "CYRILLIC CAPITAL LETTER ES"),
400x0422 => array(0xC2, "CYRILLIC CAPITAL LETTER TE"),
410x0423 => array(0xC3, "CYRILLIC CAPITAL LETTER U"),
420x0424 => array(0xC4, "CYRILLIC CAPITAL LETTER EF"),
430x0425 => array(0xC5, "CYRILLIC CAPITAL LETTER HA"),
440x0426 => array(0xC6, "CYRILLIC CAPITAL LETTER TSE"),
450x0427 => array(0xC7, "CYRILLIC CAPITAL LETTER CHE"),
460x0428 => array(0xC8, "CYRILLIC CAPITAL LETTER SHA"),
470x0429 => array(0xC9, "CYRILLIC CAPITAL LETTER SHCHA"),
480x042A => array(0xCA, "CYRILLIC CAPITAL LETTER HARD SIGN"),
490x042B => array(0xCB, "CYRILLIC CAPITAL LETTER YERU"),
500x042C => array(0xCC, "CYRILLIC CAPITAL LETTER SOFT SIGN"),
510x042D => array(0xCD, "CYRILLIC CAPITAL LETTER E"),
520x042E => array(0xCE, "CYRILLIC CAPITAL LETTER YU"),
530x042F => array(0xCF, "CYRILLIC CAPITAL LETTER YA"),
540x0430 => array(0xD0, "CYRILLIC SMALL LETTER A"),
550x0431 => array(0xD1, "CYRILLIC SMALL LETTER BE"),
560x0432 => array(0xD2, "CYRILLIC SMALL LETTER VE"),
570x0433 => array(0xD3, "CYRILLIC SMALL LETTER GHE"),
580x0434 => array(0xD4, "CYRILLIC SMALL LETTER DE"),
590x0435 => array(0xD5, "CYRILLIC SMALL LETTER IE"),
600x0436 => array(0xD6, "CYRILLIC SMALL LETTER ZHE"),
610x0437 => array(0xD7, "CYRILLIC SMALL LETTER ZE"),
620x0438 => array(0xD8, "CYRILLIC SMALL LETTER I"),
630x0439 => array(0xD9, "CYRILLIC SMALL LETTER SHORT I"),
640x043A => array(0xDA, "CYRILLIC SMALL LETTER KA"),
650x043B => array(0xDB, "CYRILLIC SMALL LETTER EL"),
660x043C => array(0xDC, "CYRILLIC SMALL LETTER EM"),
670x043D => array(0xDD, "CYRILLIC SMALL LETTER EN"),
680x043E => array(0xDE, "CYRILLIC SMALL LETTER O"),
690x043F => array(0xDF, "CYRILLIC SMALL LETTER PE"),
700x0440 => array(0xE0, "CYRILLIC SMALL LETTER ER"),
710x0441 => array(0xE1, "CYRILLIC SMALL LETTER ES"),
720x0442 => array(0xE2, "CYRILLIC SMALL LETTER TE"),
730x0443 => array(0xE3, "CYRILLIC SMALL LETTER U"),
740x0444 => array(0xE4, "CYRILLIC SMALL LETTER EF"),
750x0445 => array(0xE5, "CYRILLIC SMALL LETTER HA"),
760x0446 => array(0xE6, "CYRILLIC SMALL LETTER TSE"),
770x0447 => array(0xE7, "CYRILLIC SMALL LETTER CHE"),
780x0448 => array(0xE8, "CYRILLIC SMALL LETTER SHA"),
790x0449 => array(0xE9, "CYRILLIC SMALL LETTER SHCHA"),
800x044A => array(0xEA, "CYRILLIC SMALL LETTER HARD SIGN"),
810x044B => array(0xEB, "CYRILLIC SMALL LETTER YERU"),
820x044C => array(0xEC, "CYRILLIC SMALL LETTER SOFT SIGN"),
830x044D => array(0xED, "CYRILLIC SMALL LETTER E"),
840x044E => array(0xEE, "CYRILLIC SMALL LETTER YU"),
850x044F => array(0xEF, "CYRILLIC SMALL LETTER YA"),
860x2116 => array(0xF0, "NUMERO SIGN"),
870x0451 => array(0xF1, "CYRILLIC SMALL LETTER IO"),
880x0452 => array(0xF2, "CYRILLIC SMALL LETTER DJE"),
890x0453 => array(0xF3, "CYRILLIC SMALL LETTER GJE"),
900x0454 => array(0xF4, "CYRILLIC SMALL LETTER UKRAINIAN IE"),
910x0455 => array(0xF5, "CYRILLIC SMALL LETTER DZE"),
920x0456 => array(0xF6, "CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I"),
930x0457 => array(0xF7, "CYRILLIC SMALL LETTER YI"),
940x0458 => array(0xF8, "CYRILLIC SMALL LETTER JE"),
950x0459 => array(0xF9, "CYRILLIC SMALL LETTER LJE"),
960x045A => array(0xFA, "CYRILLIC SMALL LETTER NJE"),
970x045B => array(0xFB, "CYRILLIC SMALL LETTER TSHE"),
980x045C => array(0xFC, "CYRILLIC SMALL LETTER KJE"),
990x00A7 => array(0xFD, "SECTION SIGN"),
1000x045E => array(0xFE, "CYRILLIC SMALL LETTER SHORT U"),
1010x045F => array(0xFF, "CYRILLIC SMALL LETTER DZHE"),
102);
103
104foreach ($arr as $u => $v) {
105    $ent = sprintf("&#x%X;", $u);
106    $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-5');
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-5');
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
121CYRILLIC CAPITAL LETTER IO: &#x401; => a1
122&#xA1; => &#xA1;
123
124CYRILLIC CAPITAL LETTER DJE: &#x402; => a2
125&#xA2; => &#xA2;
126
127CYRILLIC CAPITAL LETTER GJE: &#x403; => a3
128&#xA3; => &#xA3;
129
130CYRILLIC CAPITAL LETTER UKRAINIAN IE: &#x404; => a4
131&#xA4; => &#xA4;
132
133CYRILLIC CAPITAL LETTER DZE: &#x405; => a5
134&#xA5; => &#xA5;
135
136CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: &#x406; => a6
137&#xA6; => &#xA6;
138
139CYRILLIC CAPITAL LETTER YI: &#x407; => a7
140&#xA7; => fd
141
142CYRILLIC CAPITAL LETTER JE: &#x408; => a8
143&#xA8; => &#xA8;
144
145CYRILLIC CAPITAL LETTER LJE: &#x409; => a9
146&#xA9; => &#xA9;
147
148CYRILLIC CAPITAL LETTER NJE: &#x40A; => aa
149&#xAA; => &#xAA;
150
151CYRILLIC CAPITAL LETTER TSHE: &#x40B; => ab
152&#xAB; => &#xAB;
153
154CYRILLIC CAPITAL LETTER KJE: &#x40C; => ac
155&#xAC; => &#xAC;
156
157SOFT HYPHEN: &#xAD; => ad
158&#xAD; => ad
159
160CYRILLIC CAPITAL LETTER SHORT U: &#x40E; => ae
161&#xAE; => &#xAE;
162
163CYRILLIC CAPITAL LETTER DZHE: &#x40F; => af
164&#xAF; => &#xAF;
165
166CYRILLIC CAPITAL LETTER A: &#x410; => b0
167&#xB0; => &#xB0;
168
169CYRILLIC CAPITAL LETTER BE: &#x411; => b1
170&#xB1; => &#xB1;
171
172CYRILLIC CAPITAL LETTER VE: &#x412; => b2
173&#xB2; => &#xB2;
174
175CYRILLIC CAPITAL LETTER GHE: &#x413; => b3
176&#xB3; => &#xB3;
177
178CYRILLIC CAPITAL LETTER DE: &#x414; => b4
179&#xB4; => &#xB4;
180
181CYRILLIC CAPITAL LETTER IE: &#x415; => b5
182&#xB5; => &#xB5;
183
184CYRILLIC CAPITAL LETTER ZHE: &#x416; => b6
185&#xB6; => &#xB6;
186
187CYRILLIC CAPITAL LETTER ZE: &#x417; => b7
188&#xB7; => &#xB7;
189
190CYRILLIC CAPITAL LETTER I: &#x418; => b8
191&#xB8; => &#xB8;
192
193CYRILLIC CAPITAL LETTER SHORT I: &#x419; => b9
194&#xB9; => &#xB9;
195
196CYRILLIC CAPITAL LETTER KA: &#x41A; => ba
197&#xBA; => &#xBA;
198
199CYRILLIC CAPITAL LETTER EL: &#x41B; => bb
200&#xBB; => &#xBB;
201
202CYRILLIC CAPITAL LETTER EM: &#x41C; => bc
203&#xBC; => &#xBC;
204
205CYRILLIC CAPITAL LETTER EN: &#x41D; => bd
206&#xBD; => &#xBD;
207
208CYRILLIC CAPITAL LETTER O: &#x41E; => be
209&#xBE; => &#xBE;
210
211CYRILLIC CAPITAL LETTER PE: &#x41F; => bf
212&#xBF; => &#xBF;
213
214CYRILLIC CAPITAL LETTER ER: &#x420; => c0
215&#xC0; => &#xC0;
216
217CYRILLIC CAPITAL LETTER ES: &#x421; => c1
218&#xC1; => &#xC1;
219
220CYRILLIC CAPITAL LETTER TE: &#x422; => c2
221&#xC2; => &#xC2;
222
223CYRILLIC CAPITAL LETTER U: &#x423; => c3
224&#xC3; => &#xC3;
225
226CYRILLIC CAPITAL LETTER EF: &#x424; => c4
227&#xC4; => &#xC4;
228
229CYRILLIC CAPITAL LETTER HA: &#x425; => c5
230&#xC5; => &#xC5;
231
232CYRILLIC CAPITAL LETTER TSE: &#x426; => c6
233&#xC6; => &#xC6;
234
235CYRILLIC CAPITAL LETTER CHE: &#x427; => c7
236&#xC7; => &#xC7;
237
238CYRILLIC CAPITAL LETTER SHA: &#x428; => c8
239&#xC8; => &#xC8;
240
241CYRILLIC CAPITAL LETTER SHCHA: &#x429; => c9
242&#xC9; => &#xC9;
243
244CYRILLIC CAPITAL LETTER HARD SIGN: &#x42A; => ca
245&#xCA; => &#xCA;
246
247CYRILLIC CAPITAL LETTER YERU: &#x42B; => cb
248&#xCB; => &#xCB;
249
250CYRILLIC CAPITAL LETTER SOFT SIGN: &#x42C; => cc
251&#xCC; => &#xCC;
252
253CYRILLIC CAPITAL LETTER E: &#x42D; => cd
254&#xCD; => &#xCD;
255
256CYRILLIC CAPITAL LETTER YU: &#x42E; => ce
257&#xCE; => &#xCE;
258
259CYRILLIC CAPITAL LETTER YA: &#x42F; => cf
260&#xCF; => &#xCF;
261
262CYRILLIC SMALL LETTER A: &#x430; => d0
263&#xD0; => &#xD0;
264
265CYRILLIC SMALL LETTER BE: &#x431; => d1
266&#xD1; => &#xD1;
267
268CYRILLIC SMALL LETTER VE: &#x432; => d2
269&#xD2; => &#xD2;
270
271CYRILLIC SMALL LETTER GHE: &#x433; => d3
272&#xD3; => &#xD3;
273
274CYRILLIC SMALL LETTER DE: &#x434; => d4
275&#xD4; => &#xD4;
276
277CYRILLIC SMALL LETTER IE: &#x435; => d5
278&#xD5; => &#xD5;
279
280CYRILLIC SMALL LETTER ZHE: &#x436; => d6
281&#xD6; => &#xD6;
282
283CYRILLIC SMALL LETTER ZE: &#x437; => d7
284&#xD7; => &#xD7;
285
286CYRILLIC SMALL LETTER I: &#x438; => d8
287&#xD8; => &#xD8;
288
289CYRILLIC SMALL LETTER SHORT I: &#x439; => d9
290&#xD9; => &#xD9;
291
292CYRILLIC SMALL LETTER KA: &#x43A; => da
293&#xDA; => &#xDA;
294
295CYRILLIC SMALL LETTER EL: &#x43B; => db
296&#xDB; => &#xDB;
297
298CYRILLIC SMALL LETTER EM: &#x43C; => dc
299&#xDC; => &#xDC;
300
301CYRILLIC SMALL LETTER EN: &#x43D; => dd
302&#xDD; => &#xDD;
303
304CYRILLIC SMALL LETTER O: &#x43E; => de
305&#xDE; => &#xDE;
306
307CYRILLIC SMALL LETTER PE: &#x43F; => df
308&#xDF; => &#xDF;
309
310CYRILLIC SMALL LETTER ER: &#x440; => e0
311&#xE0; => &#xE0;
312
313CYRILLIC SMALL LETTER ES: &#x441; => e1
314&#xE1; => &#xE1;
315
316CYRILLIC SMALL LETTER TE: &#x442; => e2
317&#xE2; => &#xE2;
318
319CYRILLIC SMALL LETTER U: &#x443; => e3
320&#xE3; => &#xE3;
321
322CYRILLIC SMALL LETTER EF: &#x444; => e4
323&#xE4; => &#xE4;
324
325CYRILLIC SMALL LETTER HA: &#x445; => e5
326&#xE5; => &#xE5;
327
328CYRILLIC SMALL LETTER TSE: &#x446; => e6
329&#xE6; => &#xE6;
330
331CYRILLIC SMALL LETTER CHE: &#x447; => e7
332&#xE7; => &#xE7;
333
334CYRILLIC SMALL LETTER SHA: &#x448; => e8
335&#xE8; => &#xE8;
336
337CYRILLIC SMALL LETTER SHCHA: &#x449; => e9
338&#xE9; => &#xE9;
339
340CYRILLIC SMALL LETTER HARD SIGN: &#x44A; => ea
341&#xEA; => &#xEA;
342
343CYRILLIC SMALL LETTER YERU: &#x44B; => eb
344&#xEB; => &#xEB;
345
346CYRILLIC SMALL LETTER SOFT SIGN: &#x44C; => ec
347&#xEC; => &#xEC;
348
349CYRILLIC SMALL LETTER E: &#x44D; => ed
350&#xED; => &#xED;
351
352CYRILLIC SMALL LETTER YU: &#x44E; => ee
353&#xEE; => &#xEE;
354
355CYRILLIC SMALL LETTER YA: &#x44F; => ef
356&#xEF; => &#xEF;
357
358NUMERO SIGN: &#x2116; => f0
359&#xF0; => &#xF0;
360
361CYRILLIC SMALL LETTER IO: &#x451; => f1
362&#xF1; => &#xF1;
363
364CYRILLIC SMALL LETTER DJE: &#x452; => f2
365&#xF2; => &#xF2;
366
367CYRILLIC SMALL LETTER GJE: &#x453; => f3
368&#xF3; => &#xF3;
369
370CYRILLIC SMALL LETTER UKRAINIAN IE: &#x454; => f4
371&#xF4; => &#xF4;
372
373CYRILLIC SMALL LETTER DZE: &#x455; => f5
374&#xF5; => &#xF5;
375
376CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: &#x456; => f6
377&#xF6; => &#xF6;
378
379CYRILLIC SMALL LETTER YI: &#x457; => f7
380&#xF7; => &#xF7;
381
382CYRILLIC SMALL LETTER JE: &#x458; => f8
383&#xF8; => &#xF8;
384
385CYRILLIC SMALL LETTER LJE: &#x459; => f9
386&#xF9; => &#xF9;
387
388CYRILLIC SMALL LETTER NJE: &#x45A; => fa
389&#xFA; => &#xFA;
390
391CYRILLIC SMALL LETTER TSHE: &#x45B; => fb
392&#xFB; => &#xFB;
393
394CYRILLIC SMALL LETTER KJE: &#x45C; => fc
395&#xFC; => &#xFC;
396
397SECTION SIGN: &#xA7; => fd
398&#xFD; => &#xFD;
399
400CYRILLIC SMALL LETTER SHORT U: &#x45E; => fe
401&#xFE; => &#xFE;
402
403CYRILLIC SMALL LETTER DZHE: &#x45F; => ff
404&#xFF; => &#xFF;
405