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--EXPECT--
117NO-BREAK SPACE: &#xA0; => a0
118&#xA0; => a0
119
120CYRILLIC CAPITAL LETTER IO: &#x401; => a1
121&#xA1; => &#xA1;
122
123CYRILLIC CAPITAL LETTER DJE: &#x402; => a2
124&#xA2; => &#xA2;
125
126CYRILLIC CAPITAL LETTER GJE: &#x403; => a3
127&#xA3; => &#xA3;
128
129CYRILLIC CAPITAL LETTER UKRAINIAN IE: &#x404; => a4
130&#xA4; => &#xA4;
131
132CYRILLIC CAPITAL LETTER DZE: &#x405; => a5
133&#xA5; => &#xA5;
134
135CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: &#x406; => a6
136&#xA6; => &#xA6;
137
138CYRILLIC CAPITAL LETTER YI: &#x407; => a7
139&#xA7; => fd
140
141CYRILLIC CAPITAL LETTER JE: &#x408; => a8
142&#xA8; => &#xA8;
143
144CYRILLIC CAPITAL LETTER LJE: &#x409; => a9
145&#xA9; => &#xA9;
146
147CYRILLIC CAPITAL LETTER NJE: &#x40A; => aa
148&#xAA; => &#xAA;
149
150CYRILLIC CAPITAL LETTER TSHE: &#x40B; => ab
151&#xAB; => &#xAB;
152
153CYRILLIC CAPITAL LETTER KJE: &#x40C; => ac
154&#xAC; => &#xAC;
155
156SOFT HYPHEN: &#xAD; => ad
157&#xAD; => ad
158
159CYRILLIC CAPITAL LETTER SHORT U: &#x40E; => ae
160&#xAE; => &#xAE;
161
162CYRILLIC CAPITAL LETTER DZHE: &#x40F; => af
163&#xAF; => &#xAF;
164
165CYRILLIC CAPITAL LETTER A: &#x410; => b0
166&#xB0; => &#xB0;
167
168CYRILLIC CAPITAL LETTER BE: &#x411; => b1
169&#xB1; => &#xB1;
170
171CYRILLIC CAPITAL LETTER VE: &#x412; => b2
172&#xB2; => &#xB2;
173
174CYRILLIC CAPITAL LETTER GHE: &#x413; => b3
175&#xB3; => &#xB3;
176
177CYRILLIC CAPITAL LETTER DE: &#x414; => b4
178&#xB4; => &#xB4;
179
180CYRILLIC CAPITAL LETTER IE: &#x415; => b5
181&#xB5; => &#xB5;
182
183CYRILLIC CAPITAL LETTER ZHE: &#x416; => b6
184&#xB6; => &#xB6;
185
186CYRILLIC CAPITAL LETTER ZE: &#x417; => b7
187&#xB7; => &#xB7;
188
189CYRILLIC CAPITAL LETTER I: &#x418; => b8
190&#xB8; => &#xB8;
191
192CYRILLIC CAPITAL LETTER SHORT I: &#x419; => b9
193&#xB9; => &#xB9;
194
195CYRILLIC CAPITAL LETTER KA: &#x41A; => ba
196&#xBA; => &#xBA;
197
198CYRILLIC CAPITAL LETTER EL: &#x41B; => bb
199&#xBB; => &#xBB;
200
201CYRILLIC CAPITAL LETTER EM: &#x41C; => bc
202&#xBC; => &#xBC;
203
204CYRILLIC CAPITAL LETTER EN: &#x41D; => bd
205&#xBD; => &#xBD;
206
207CYRILLIC CAPITAL LETTER O: &#x41E; => be
208&#xBE; => &#xBE;
209
210CYRILLIC CAPITAL LETTER PE: &#x41F; => bf
211&#xBF; => &#xBF;
212
213CYRILLIC CAPITAL LETTER ER: &#x420; => c0
214&#xC0; => &#xC0;
215
216CYRILLIC CAPITAL LETTER ES: &#x421; => c1
217&#xC1; => &#xC1;
218
219CYRILLIC CAPITAL LETTER TE: &#x422; => c2
220&#xC2; => &#xC2;
221
222CYRILLIC CAPITAL LETTER U: &#x423; => c3
223&#xC3; => &#xC3;
224
225CYRILLIC CAPITAL LETTER EF: &#x424; => c4
226&#xC4; => &#xC4;
227
228CYRILLIC CAPITAL LETTER HA: &#x425; => c5
229&#xC5; => &#xC5;
230
231CYRILLIC CAPITAL LETTER TSE: &#x426; => c6
232&#xC6; => &#xC6;
233
234CYRILLIC CAPITAL LETTER CHE: &#x427; => c7
235&#xC7; => &#xC7;
236
237CYRILLIC CAPITAL LETTER SHA: &#x428; => c8
238&#xC8; => &#xC8;
239
240CYRILLIC CAPITAL LETTER SHCHA: &#x429; => c9
241&#xC9; => &#xC9;
242
243CYRILLIC CAPITAL LETTER HARD SIGN: &#x42A; => ca
244&#xCA; => &#xCA;
245
246CYRILLIC CAPITAL LETTER YERU: &#x42B; => cb
247&#xCB; => &#xCB;
248
249CYRILLIC CAPITAL LETTER SOFT SIGN: &#x42C; => cc
250&#xCC; => &#xCC;
251
252CYRILLIC CAPITAL LETTER E: &#x42D; => cd
253&#xCD; => &#xCD;
254
255CYRILLIC CAPITAL LETTER YU: &#x42E; => ce
256&#xCE; => &#xCE;
257
258CYRILLIC CAPITAL LETTER YA: &#x42F; => cf
259&#xCF; => &#xCF;
260
261CYRILLIC SMALL LETTER A: &#x430; => d0
262&#xD0; => &#xD0;
263
264CYRILLIC SMALL LETTER BE: &#x431; => d1
265&#xD1; => &#xD1;
266
267CYRILLIC SMALL LETTER VE: &#x432; => d2
268&#xD2; => &#xD2;
269
270CYRILLIC SMALL LETTER GHE: &#x433; => d3
271&#xD3; => &#xD3;
272
273CYRILLIC SMALL LETTER DE: &#x434; => d4
274&#xD4; => &#xD4;
275
276CYRILLIC SMALL LETTER IE: &#x435; => d5
277&#xD5; => &#xD5;
278
279CYRILLIC SMALL LETTER ZHE: &#x436; => d6
280&#xD6; => &#xD6;
281
282CYRILLIC SMALL LETTER ZE: &#x437; => d7
283&#xD7; => &#xD7;
284
285CYRILLIC SMALL LETTER I: &#x438; => d8
286&#xD8; => &#xD8;
287
288CYRILLIC SMALL LETTER SHORT I: &#x439; => d9
289&#xD9; => &#xD9;
290
291CYRILLIC SMALL LETTER KA: &#x43A; => da
292&#xDA; => &#xDA;
293
294CYRILLIC SMALL LETTER EL: &#x43B; => db
295&#xDB; => &#xDB;
296
297CYRILLIC SMALL LETTER EM: &#x43C; => dc
298&#xDC; => &#xDC;
299
300CYRILLIC SMALL LETTER EN: &#x43D; => dd
301&#xDD; => &#xDD;
302
303CYRILLIC SMALL LETTER O: &#x43E; => de
304&#xDE; => &#xDE;
305
306CYRILLIC SMALL LETTER PE: &#x43F; => df
307&#xDF; => &#xDF;
308
309CYRILLIC SMALL LETTER ER: &#x440; => e0
310&#xE0; => &#xE0;
311
312CYRILLIC SMALL LETTER ES: &#x441; => e1
313&#xE1; => &#xE1;
314
315CYRILLIC SMALL LETTER TE: &#x442; => e2
316&#xE2; => &#xE2;
317
318CYRILLIC SMALL LETTER U: &#x443; => e3
319&#xE3; => &#xE3;
320
321CYRILLIC SMALL LETTER EF: &#x444; => e4
322&#xE4; => &#xE4;
323
324CYRILLIC SMALL LETTER HA: &#x445; => e5
325&#xE5; => &#xE5;
326
327CYRILLIC SMALL LETTER TSE: &#x446; => e6
328&#xE6; => &#xE6;
329
330CYRILLIC SMALL LETTER CHE: &#x447; => e7
331&#xE7; => &#xE7;
332
333CYRILLIC SMALL LETTER SHA: &#x448; => e8
334&#xE8; => &#xE8;
335
336CYRILLIC SMALL LETTER SHCHA: &#x449; => e9
337&#xE9; => &#xE9;
338
339CYRILLIC SMALL LETTER HARD SIGN: &#x44A; => ea
340&#xEA; => &#xEA;
341
342CYRILLIC SMALL LETTER YERU: &#x44B; => eb
343&#xEB; => &#xEB;
344
345CYRILLIC SMALL LETTER SOFT SIGN: &#x44C; => ec
346&#xEC; => &#xEC;
347
348CYRILLIC SMALL LETTER E: &#x44D; => ed
349&#xED; => &#xED;
350
351CYRILLIC SMALL LETTER YU: &#x44E; => ee
352&#xEE; => &#xEE;
353
354CYRILLIC SMALL LETTER YA: &#x44F; => ef
355&#xEF; => &#xEF;
356
357NUMERO SIGN: &#x2116; => f0
358&#xF0; => &#xF0;
359
360CYRILLIC SMALL LETTER IO: &#x451; => 2623783435313b
361&#xF1; => &#xF1;
362
363CYRILLIC SMALL LETTER DJE: &#x452; => 2623783435323b
364&#xF2; => &#xF2;
365
366CYRILLIC SMALL LETTER GJE: &#x453; => 2623783435333b
367&#xF3; => &#xF3;
368
369CYRILLIC SMALL LETTER UKRAINIAN IE: &#x454; => 2623783435343b
370&#xF4; => &#xF4;
371
372CYRILLIC SMALL LETTER DZE: &#x455; => 2623783435353b
373&#xF5; => &#xF5;
374
375CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: &#x456; => 2623783435363b
376&#xF6; => &#xF6;
377
378CYRILLIC SMALL LETTER YI: &#x457; => 2623783435373b
379&#xF7; => &#xF7;
380
381CYRILLIC SMALL LETTER JE: &#x458; => 2623783435383b
382&#xF8; => &#xF8;
383
384CYRILLIC SMALL LETTER LJE: &#x459; => 2623783435393b
385&#xF9; => &#xF9;
386
387CYRILLIC SMALL LETTER NJE: &#x45A; => 2623783435413b
388&#xFA; => &#xFA;
389
390CYRILLIC SMALL LETTER TSHE: &#x45B; => 2623783435423b
391&#xFB; => &#xFB;
392
393CYRILLIC SMALL LETTER KJE: &#x45C; => 2623783435433b
394&#xFC; => &#xFC;
395
396SECTION SIGN: &#xA7; => fd
397&#xFD; => &#xFD;
398
399CYRILLIC SMALL LETTER SHORT U: &#x45E; => 2623783435453b
400&#xFE; => &#xFE;
401
402CYRILLIC SMALL LETTER DZHE: &#x45F; => 2623783435463b
403&#xFF; => &#xFF;
404
405
406