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:   => a0 118  => a0 119 120CYRILLIC CAPITAL LETTER IO: Ё => a1 121¡ => ¡ 122 123CYRILLIC CAPITAL LETTER DJE: Ђ => a2 124¢ => ¢ 125 126CYRILLIC CAPITAL LETTER GJE: Ѓ => a3 127£ => £ 128 129CYRILLIC CAPITAL LETTER UKRAINIAN IE: Є => a4 130¤ => ¤ 131 132CYRILLIC CAPITAL LETTER DZE: Ѕ => a5 133¥ => ¥ 134 135CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I: І => a6 136¦ => ¦ 137 138CYRILLIC CAPITAL LETTER YI: Ї => a7 139§ => fd 140 141CYRILLIC CAPITAL LETTER JE: Ј => a8 142¨ => ¨ 143 144CYRILLIC CAPITAL LETTER LJE: Љ => a9 145© => © 146 147CYRILLIC CAPITAL LETTER NJE: Њ => aa 148ª => ª 149 150CYRILLIC CAPITAL LETTER TSHE: Ћ => ab 151« => « 152 153CYRILLIC CAPITAL LETTER KJE: Ќ => ac 154¬ => ¬ 155 156SOFT HYPHEN: ­ => ad 157­ => ad 158 159CYRILLIC CAPITAL LETTER SHORT U: Ў => ae 160® => ® 161 162CYRILLIC CAPITAL LETTER DZHE: Џ => af 163¯ => ¯ 164 165CYRILLIC CAPITAL LETTER A: А => b0 166° => ° 167 168CYRILLIC CAPITAL LETTER BE: Б => b1 169± => ± 170 171CYRILLIC CAPITAL LETTER VE: В => b2 172² => ² 173 174CYRILLIC CAPITAL LETTER GHE: Г => b3 175³ => ³ 176 177CYRILLIC CAPITAL LETTER DE: Д => b4 178´ => ´ 179 180CYRILLIC CAPITAL LETTER IE: Е => b5 181µ => µ 182 183CYRILLIC CAPITAL LETTER ZHE: Ж => b6 184¶ => ¶ 185 186CYRILLIC CAPITAL LETTER ZE: З => b7 187· => · 188 189CYRILLIC CAPITAL LETTER I: И => b8 190¸ => ¸ 191 192CYRILLIC CAPITAL LETTER SHORT I: Й => b9 193¹ => ¹ 194 195CYRILLIC CAPITAL LETTER KA: К => ba 196º => º 197 198CYRILLIC CAPITAL LETTER EL: Л => bb 199» => » 200 201CYRILLIC CAPITAL LETTER EM: М => bc 202¼ => ¼ 203 204CYRILLIC CAPITAL LETTER EN: Н => bd 205½ => ½ 206 207CYRILLIC CAPITAL LETTER O: О => be 208¾ => ¾ 209 210CYRILLIC CAPITAL LETTER PE: П => bf 211¿ => ¿ 212 213CYRILLIC CAPITAL LETTER ER: Р => c0 214À => À 215 216CYRILLIC CAPITAL LETTER ES: С => c1 217Á => Á 218 219CYRILLIC CAPITAL LETTER TE: Т => c2 220Â => Â 221 222CYRILLIC CAPITAL LETTER U: У => c3 223Ã => Ã 224 225CYRILLIC CAPITAL LETTER EF: Ф => c4 226Ä => Ä 227 228CYRILLIC CAPITAL LETTER HA: Х => c5 229Å => Å 230 231CYRILLIC CAPITAL LETTER TSE: Ц => c6 232Æ => Æ 233 234CYRILLIC CAPITAL LETTER CHE: Ч => c7 235Ç => Ç 236 237CYRILLIC CAPITAL LETTER SHA: Ш => c8 238È => È 239 240CYRILLIC CAPITAL LETTER SHCHA: Щ => c9 241É => É 242 243CYRILLIC CAPITAL LETTER HARD SIGN: Ъ => ca 244Ê => Ê 245 246CYRILLIC CAPITAL LETTER YERU: Ы => cb 247Ë => Ë 248 249CYRILLIC CAPITAL LETTER SOFT SIGN: Ь => cc 250Ì => Ì 251 252CYRILLIC CAPITAL LETTER E: Э => cd 253Í => Í 254 255CYRILLIC CAPITAL LETTER YU: Ю => ce 256Î => Î 257 258CYRILLIC CAPITAL LETTER YA: Я => cf 259Ï => Ï 260 261CYRILLIC SMALL LETTER A: а => d0 262Ð => Ð 263 264CYRILLIC SMALL LETTER BE: б => d1 265Ñ => Ñ 266 267CYRILLIC SMALL LETTER VE: в => d2 268Ò => Ò 269 270CYRILLIC SMALL LETTER GHE: г => d3 271Ó => Ó 272 273CYRILLIC SMALL LETTER DE: д => d4 274Ô => Ô 275 276CYRILLIC SMALL LETTER IE: е => d5 277Õ => Õ 278 279CYRILLIC SMALL LETTER ZHE: ж => d6 280Ö => Ö 281 282CYRILLIC SMALL LETTER ZE: з => d7 283× => × 284 285CYRILLIC SMALL LETTER I: и => d8 286Ø => Ø 287 288CYRILLIC SMALL LETTER SHORT I: й => d9 289Ù => Ù 290 291CYRILLIC SMALL LETTER KA: к => da 292Ú => Ú 293 294CYRILLIC SMALL LETTER EL: л => db 295Û => Û 296 297CYRILLIC SMALL LETTER EM: м => dc 298Ü => Ü 299 300CYRILLIC SMALL LETTER EN: н => dd 301Ý => Ý 302 303CYRILLIC SMALL LETTER O: о => de 304Þ => Þ 305 306CYRILLIC SMALL LETTER PE: п => df 307ß => ß 308 309CYRILLIC SMALL LETTER ER: р => e0 310à => à 311 312CYRILLIC SMALL LETTER ES: с => e1 313á => á 314 315CYRILLIC SMALL LETTER TE: т => e2 316â => â 317 318CYRILLIC SMALL LETTER U: у => e3 319ã => ã 320 321CYRILLIC SMALL LETTER EF: ф => e4 322ä => ä 323 324CYRILLIC SMALL LETTER HA: х => e5 325å => å 326 327CYRILLIC SMALL LETTER TSE: ц => e6 328æ => æ 329 330CYRILLIC SMALL LETTER CHE: ч => e7 331ç => ç 332 333CYRILLIC SMALL LETTER SHA: ш => e8 334è => è 335 336CYRILLIC SMALL LETTER SHCHA: щ => e9 337é => é 338 339CYRILLIC SMALL LETTER HARD SIGN: ъ => ea 340ê => ê 341 342CYRILLIC SMALL LETTER YERU: ы => eb 343ë => ë 344 345CYRILLIC SMALL LETTER SOFT SIGN: ь => ec 346ì => ì 347 348CYRILLIC SMALL LETTER E: э => ed 349í => í 350 351CYRILLIC SMALL LETTER YU: ю => ee 352î => î 353 354CYRILLIC SMALL LETTER YA: я => ef 355ï => ï 356 357NUMERO SIGN: № => f0 358ð => ð 359 360CYRILLIC SMALL LETTER IO: ё => 2623783435313b 361ñ => ñ 362 363CYRILLIC SMALL LETTER DJE: ђ => 2623783435323b 364ò => ò 365 366CYRILLIC SMALL LETTER GJE: ѓ => 2623783435333b 367ó => ó 368 369CYRILLIC SMALL LETTER UKRAINIAN IE: є => 2623783435343b 370ô => ô 371 372CYRILLIC SMALL LETTER DZE: ѕ => 2623783435353b 373õ => õ 374 375CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I: і => 2623783435363b 376ö => ö 377 378CYRILLIC SMALL LETTER YI: ї => 2623783435373b 379÷ => ÷ 380 381CYRILLIC SMALL LETTER JE: ј => 2623783435383b 382ø => ø 383 384CYRILLIC SMALL LETTER LJE: љ => 2623783435393b 385ù => ù 386 387CYRILLIC SMALL LETTER NJE: њ => 2623783435413b 388ú => ú 389 390CYRILLIC SMALL LETTER TSHE: ћ => 2623783435423b 391û => û 392 393CYRILLIC SMALL LETTER KJE: ќ => 2623783435433b 394ü => ü 395 396SECTION SIGN: § => fd 397ý => ý 398 399CYRILLIC SMALL LETTER SHORT U: ў => 2623783435453b 400þ => þ 401 402CYRILLIC SMALL LETTER DZHE: џ => 2623783435463b 403ÿ => ÿ 404