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