1--TEST-- 2Translation of HTML entities for encoding KOI8-R 3--FILE-- 4<?php 5$arr = array( 60x2500 => array(0x80, "BOX DRAWINGS LIGHT HORIZONTAL"), 70x2502 => array(0x81, "BOX DRAWINGS LIGHT VERTICAL"), 80x250C => array(0x82, "BOX DRAWINGS LIGHT DOWN AND RIGHT"), 90x2510 => array(0x83, "BOX DRAWINGS LIGHT DOWN AND LEFT"), 100x2514 => array(0x84, "BOX DRAWINGS LIGHT UP AND RIGHT"), 110x2518 => array(0x85, "BOX DRAWINGS LIGHT UP AND LEFT"), 120x251C => array(0x86, "BOX DRAWINGS LIGHT VERTICAL AND RIGHT"), 130x2524 => array(0x87, "BOX DRAWINGS LIGHT VERTICAL AND LEFT"), 140x252C => array(0x88, "BOX DRAWINGS LIGHT DOWN AND HORIZONTAL"), 150x2534 => array(0x89, "BOX DRAWINGS LIGHT UP AND HORIZONTAL"), 160x253C => array(0x8A, "BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL"), 170x2580 => array(0x8B, "UPPER HALF BLOCK"), 180x2584 => array(0x8C, "LOWER HALF BLOCK"), 190x2588 => array(0x8D, "FULL BLOCK"), 200x258C => array(0x8E, "LEFT HALF BLOCK"), 210x2590 => array(0x8F, "RIGHT HALF BLOCK"), 220x2591 => array(0x90, "LIGHT SHADE"), 230x2592 => array(0x91, "MEDIUM SHADE"), 240x2593 => array(0x92, "DARK SHADE"), 250x2320 => array(0x93, "TOP HALF INTEGRAL"), 260x25A0 => array(0x94, "BLACK SQUARE"), 270x2219 => array(0x95, "BULLET OPERATOR"), 280x221A => array(0x96, "SQUARE ROOT"), 290x2248 => array(0x97, "ALMOST EQUAL TO"), 300x2264 => array(0x98, "LESS-THAN OR EQUAL TO"), 310x2265 => array(0x99, "GREATER-THAN OR EQUAL TO"), 320x00A0 => array(0x9A, "NO-BREAK SPACE"), 330x2321 => array(0x9B, "BOTTOM HALF INTEGRAL"), 340x00B0 => array(0x9C, "DEGREE SIGN"), 350x00B2 => array(0x9D, "SUPERSCRIPT TWO"), 360x00B7 => array(0x9E, "MIDDLE DOT"), 370x00F7 => array(0x9F, "DIVISION SIGN"), 380x2550 => array(0xA0, "BOX DRAWINGS DOUBLE HORIZONTAL"), 390x2551 => array(0xA1, "BOX DRAWINGS DOUBLE VERTICAL"), 400x2552 => array(0xA2, "BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE"), 410x0451 => array(0xA3, "CYRILLIC SMALL LETTER IO"), 420x2553 => array(0xA4, "BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE"), 430x2554 => array(0xA5, "BOX DRAWINGS DOUBLE DOWN AND RIGHT"), 440x2555 => array(0xA6, "BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE"), 450x2556 => array(0xA7, "BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE"), 460x2557 => array(0xA8, "BOX DRAWINGS DOUBLE DOWN AND LEFT"), 470x2558 => array(0xA9, "BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE"), 480x2559 => array(0xAA, "BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE"), 490x255A => array(0xAB, "BOX DRAWINGS DOUBLE UP AND RIGHT"), 500x255B => array(0xAC, "BOX DRAWINGS UP SINGLE AND LEFT DOUBLE"), 510x255C => array(0xAD, "BOX DRAWINGS UP DOUBLE AND LEFT SINGLE"), 520x255D => array(0xAE, "BOX DRAWINGS DOUBLE UP AND LEFT"), 530x255E => array(0xAF, "BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE"), 540x255F => array(0xB0, "BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE"), 550x2560 => array(0xB1, "BOX DRAWINGS DOUBLE VERTICAL AND RIGHT"), 560x2561 => array(0xB2, "BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE"), 570x0401 => array(0xB3, "CYRILLIC CAPITAL LETTER IO"), 580x2562 => array(0xB4, "BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE"), 590x2563 => array(0xB5, "BOX DRAWINGS DOUBLE VERTICAL AND LEFT"), 600x2564 => array(0xB6, "BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE"), 610x2565 => array(0xB7, "BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE"), 620x2566 => array(0xB8, "BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL"), 630x2567 => array(0xB9, "BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE"), 640x2568 => array(0xBA, "BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE"), 650x2569 => array(0xBB, "BOX DRAWINGS DOUBLE UP AND HORIZONTAL"), 660x256A => array(0xBC, "BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE"), 670x256B => array(0xBD, "BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE"), 680x256C => array(0xBE, "BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL"), 690x00A9 => array(0xBF, "COPYRIGHT SIGN"), 700x044E => array(0xC0, "CYRILLIC SMALL LETTER YU"), 710x0430 => array(0xC1, "CYRILLIC SMALL LETTER A"), 720x0431 => array(0xC2, "CYRILLIC SMALL LETTER BE"), 730x0446 => array(0xC3, "CYRILLIC SMALL LETTER TSE"), 740x0434 => array(0xC4, "CYRILLIC SMALL LETTER DE"), 750x0435 => array(0xC5, "CYRILLIC SMALL LETTER IE"), 760x0444 => array(0xC6, "CYRILLIC SMALL LETTER EF"), 770x0433 => array(0xC7, "CYRILLIC SMALL LETTER GHE"), 780x0445 => array(0xC8, "CYRILLIC SMALL LETTER HA"), 790x0438 => array(0xC9, "CYRILLIC SMALL LETTER I"), 800x0439 => array(0xCA, "CYRILLIC SMALL LETTER SHORT I"), 810x043A => array(0xCB, "CYRILLIC SMALL LETTER KA"), 820x043B => array(0xCC, "CYRILLIC SMALL LETTER EL"), 830x043C => array(0xCD, "CYRILLIC SMALL LETTER EM"), 840x043D => array(0xCE, "CYRILLIC SMALL LETTER EN"), 850x043E => array(0xCF, "CYRILLIC SMALL LETTER O"), 860x043F => array(0xD0, "CYRILLIC SMALL LETTER PE"), 870x044F => array(0xD1, "CYRILLIC SMALL LETTER YA"), 880x0440 => array(0xD2, "CYRILLIC SMALL LETTER ER"), 890x0441 => array(0xD3, "CYRILLIC SMALL LETTER ES"), 900x0442 => array(0xD4, "CYRILLIC SMALL LETTER TE"), 910x0443 => array(0xD5, "CYRILLIC SMALL LETTER U"), 920x0436 => array(0xD6, "CYRILLIC SMALL LETTER ZHE"), 930x0432 => array(0xD7, "CYRILLIC SMALL LETTER VE"), 940x044C => array(0xD8, "CYRILLIC SMALL LETTER SOFT SIGN"), 950x044B => array(0xD9, "CYRILLIC SMALL LETTER YERU"), 960x0437 => array(0xDA, "CYRILLIC SMALL LETTER ZE"), 970x0448 => array(0xDB, "CYRILLIC SMALL LETTER SHA"), 980x044D => array(0xDC, "CYRILLIC SMALL LETTER E"), 990x0449 => array(0xDD, "CYRILLIC SMALL LETTER SHCHA"), 1000x0447 => array(0xDE, "CYRILLIC SMALL LETTER CHE"), 1010x044A => array(0xDF, "CYRILLIC SMALL LETTER HARD SIGN"), 1020x042E => array(0xE0, "CYRILLIC CAPITAL LETTER YU"), 1030x0410 => array(0xE1, "CYRILLIC CAPITAL LETTER A"), 1040x0411 => array(0xE2, "CYRILLIC CAPITAL LETTER BE"), 1050x0426 => array(0xE3, "CYRILLIC CAPITAL LETTER TSE"), 1060x0414 => array(0xE4, "CYRILLIC CAPITAL LETTER DE"), 1070x0415 => array(0xE5, "CYRILLIC CAPITAL LETTER IE"), 1080x0424 => array(0xE6, "CYRILLIC CAPITAL LETTER EF"), 1090x0413 => array(0xE7, "CYRILLIC CAPITAL LETTER GHE"), 1100x0425 => array(0xE8, "CYRILLIC CAPITAL LETTER HA"), 1110x0418 => array(0xE9, "CYRILLIC CAPITAL LETTER I"), 1120x0419 => array(0xEA, "CYRILLIC CAPITAL LETTER SHORT I"), 1130x041A => array(0xEB, "CYRILLIC CAPITAL LETTER KA"), 1140x041B => array(0xEC, "CYRILLIC CAPITAL LETTER EL"), 1150x041C => array(0xED, "CYRILLIC CAPITAL LETTER EM"), 1160x041D => array(0xEE, "CYRILLIC CAPITAL LETTER EN"), 1170x041E => array(0xEF, "CYRILLIC CAPITAL LETTER O"), 1180x041F => array(0xF0, "CYRILLIC CAPITAL LETTER PE"), 1190x042F => array(0xF1, "CYRILLIC CAPITAL LETTER YA"), 1200x0420 => array(0xF2, "CYRILLIC CAPITAL LETTER ER"), 1210x0421 => array(0xF3, "CYRILLIC CAPITAL LETTER ES"), 1220x0422 => array(0xF4, "CYRILLIC CAPITAL LETTER TE"), 1230x0423 => array(0xF5, "CYRILLIC CAPITAL LETTER U"), 1240x0416 => array(0xF6, "CYRILLIC CAPITAL LETTER ZHE"), 1250x0412 => array(0xF7, "CYRILLIC CAPITAL LETTER VE"), 1260x042C => array(0xF8, "CYRILLIC CAPITAL LETTER SOFT SIGN"), 1270x042B => array(0xF9, "CYRILLIC CAPITAL LETTER YERU"), 1280x0417 => array(0xFA, "CYRILLIC CAPITAL LETTER ZE"), 1290x0428 => array(0xFB, "CYRILLIC CAPITAL LETTER SHA"), 1300x042D => array(0xFC, "CYRILLIC CAPITAL LETTER E"), 1310x0429 => array(0xFD, "CYRILLIC CAPITAL LETTER SHCHA"), 1320x0427 => array(0xFE, "CYRILLIC CAPITAL LETTER CHE"), 1330x042A => array(0xFF, "CYRILLIC CAPITAL LETTER HARD SIGN"), 134); 135 136foreach ($arr as $u => $v) { 137 $ent = sprintf("&#x%X;", $u); 138 $res = html_entity_decode($ent, ENT_QUOTES, 'KOI8-R'); 139 $d = unpack("H*", $res); 140 echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); 141 142 $ent = sprintf("&#x%X;", $v[0]); 143 $res = html_entity_decode($ent, ENT_QUOTES, 'KOI8-R'); 144 if ($res[0] != "&" || $res[1] != "#") 145 $res = unpack("H*", $res)[1]; 146 echo sprintf("%s => %s\n\n", $ent, $res); 147} 148?> 149--EXPECT-- 150BOX DRAWINGS LIGHT HORIZONTAL: ─ => 80 151€ => € 152 153BOX DRAWINGS LIGHT VERTICAL: │ => 81 154 =>  155 156BOX DRAWINGS LIGHT DOWN AND RIGHT: ┌ => 82 157‚ => ‚ 158 159BOX DRAWINGS LIGHT DOWN AND LEFT: ┐ => 83 160ƒ => ƒ 161 162BOX DRAWINGS LIGHT UP AND RIGHT: └ => 84 163„ => „ 164 165BOX DRAWINGS LIGHT UP AND LEFT: ┘ => 85 166… => … 167 168BOX DRAWINGS LIGHT VERTICAL AND RIGHT: ├ => 86 169† => † 170 171BOX DRAWINGS LIGHT VERTICAL AND LEFT: ┤ => 87 172‡ => ‡ 173 174BOX DRAWINGS LIGHT DOWN AND HORIZONTAL: ┬ => 88 175ˆ => ˆ 176 177BOX DRAWINGS LIGHT UP AND HORIZONTAL: ┴ => 89 178‰ => ‰ 179 180BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL: ┼ => 8a 181Š => Š 182 183UPPER HALF BLOCK: ▀ => 8b 184‹ => ‹ 185 186LOWER HALF BLOCK: ▄ => 8c 187Œ => Œ 188 189FULL BLOCK: █ => 8d 190 =>  191 192LEFT HALF BLOCK: ▌ => 8e 193Ž => Ž 194 195RIGHT HALF BLOCK: ▐ => 8f 196 =>  197 198LIGHT SHADE: ░ => 90 199 =>  200 201MEDIUM SHADE: ▒ => 91 202‘ => ‘ 203 204DARK SHADE: ▓ => 92 205’ => ’ 206 207TOP HALF INTEGRAL: ⌠ => 93 208“ => “ 209 210BLACK SQUARE: ■ => 94 211” => ” 212 213BULLET OPERATOR: ∙ => 95 214• => • 215 216SQUARE ROOT: √ => 96 217– => – 218 219ALMOST EQUAL TO: ≈ => 97 220— => — 221 222LESS-THAN OR EQUAL TO: ≤ => 98 223˜ => ˜ 224 225GREATER-THAN OR EQUAL TO: ≥ => 99 226™ => ™ 227 228NO-BREAK SPACE:   => 9a 229š => š 230 231BOTTOM HALF INTEGRAL: ⌡ => 9b 232› => › 233 234DEGREE SIGN: ° => 9c 235œ => œ 236 237SUPERSCRIPT TWO: ² => 9d 238 =>  239 240MIDDLE DOT: · => 9e 241ž => ž 242 243DIVISION SIGN: ÷ => 9f 244Ÿ => Ÿ 245 246BOX DRAWINGS DOUBLE HORIZONTAL: ═ => a0 247  => 9a 248 249BOX DRAWINGS DOUBLE VERTICAL: ║ => a1 250¡ => ¡ 251 252BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE: ╒ => a2 253¢ => ¢ 254 255CYRILLIC SMALL LETTER IO: ё => a3 256£ => £ 257 258BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE: ╓ => a4 259¤ => ¤ 260 261BOX DRAWINGS DOUBLE DOWN AND RIGHT: ╔ => a5 262¥ => ¥ 263 264BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE: ╕ => a6 265¦ => ¦ 266 267BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE: ╖ => a7 268§ => § 269 270BOX DRAWINGS DOUBLE DOWN AND LEFT: ╗ => a8 271¨ => ¨ 272 273BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE: ╘ => a9 274© => bf 275 276BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE: ╙ => aa 277ª => ª 278 279BOX DRAWINGS DOUBLE UP AND RIGHT: ╚ => ab 280« => « 281 282BOX DRAWINGS UP SINGLE AND LEFT DOUBLE: ╛ => ac 283¬ => ¬ 284 285BOX DRAWINGS UP DOUBLE AND LEFT SINGLE: ╜ => ad 286­ => ­ 287 288BOX DRAWINGS DOUBLE UP AND LEFT: ╝ => ae 289® => ® 290 291BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE: ╞ => af 292¯ => ¯ 293 294BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE: ╟ => b0 295° => 9c 296 297BOX DRAWINGS DOUBLE VERTICAL AND RIGHT: ╠ => b1 298± => ± 299 300BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE: ╡ => b2 301² => 9d 302 303CYRILLIC CAPITAL LETTER IO: Ё => b3 304³ => ³ 305 306BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE: ╢ => b4 307´ => ´ 308 309BOX DRAWINGS DOUBLE VERTICAL AND LEFT: ╣ => b5 310µ => µ 311 312BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE: ╤ => b6 313¶ => ¶ 314 315BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE: ╥ => b7 316· => 9e 317 318BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL: ╦ => b8 319¸ => ¸ 320 321BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE: ╧ => b9 322¹ => ¹ 323 324BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE: ╨ => ba 325º => º 326 327BOX DRAWINGS DOUBLE UP AND HORIZONTAL: ╩ => bb 328» => » 329 330BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE: ╪ => bc 331¼ => ¼ 332 333BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE: ╫ => bd 334½ => ½ 335 336BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL: ╬ => be 337¾ => ¾ 338 339COPYRIGHT SIGN: © => bf 340¿ => ¿ 341 342CYRILLIC SMALL LETTER YU: ю => c0 343À => À 344 345CYRILLIC SMALL LETTER A: а => c1 346Á => Á 347 348CYRILLIC SMALL LETTER BE: б => c2 349 =>  350 351CYRILLIC SMALL LETTER TSE: ц => c3 352à => à 353 354CYRILLIC SMALL LETTER DE: д => c4 355Ä => Ä 356 357CYRILLIC SMALL LETTER IE: е => c5 358Å => Å 359 360CYRILLIC SMALL LETTER EF: ф => c6 361Æ => Æ 362 363CYRILLIC SMALL LETTER GHE: г => c7 364Ç => Ç 365 366CYRILLIC SMALL LETTER HA: х => c8 367È => È 368 369CYRILLIC SMALL LETTER I: и => c9 370É => É 371 372CYRILLIC SMALL LETTER SHORT I: й => ca 373Ê => Ê 374 375CYRILLIC SMALL LETTER KA: к => cb 376Ë => Ë 377 378CYRILLIC SMALL LETTER EL: л => cc 379Ì => Ì 380 381CYRILLIC SMALL LETTER EM: м => cd 382Í => Í 383 384CYRILLIC SMALL LETTER EN: н => ce 385Î => Î 386 387CYRILLIC SMALL LETTER O: о => cf 388Ï => Ï 389 390CYRILLIC SMALL LETTER PE: п => d0 391Ð => Ð 392 393CYRILLIC SMALL LETTER YA: я => d1 394Ñ => Ñ 395 396CYRILLIC SMALL LETTER ER: р => d2 397Ò => Ò 398 399CYRILLIC SMALL LETTER ES: с => d3 400Ó => Ó 401 402CYRILLIC SMALL LETTER TE: т => d4 403Ô => Ô 404 405CYRILLIC SMALL LETTER U: у => d5 406Õ => Õ 407 408CYRILLIC SMALL LETTER ZHE: ж => d6 409Ö => Ö 410 411CYRILLIC SMALL LETTER VE: в => d7 412× => × 413 414CYRILLIC SMALL LETTER SOFT SIGN: ь => d8 415Ø => Ø 416 417CYRILLIC SMALL LETTER YERU: ы => d9 418Ù => Ù 419 420CYRILLIC SMALL LETTER ZE: з => da 421Ú => Ú 422 423CYRILLIC SMALL LETTER SHA: ш => db 424Û => Û 425 426CYRILLIC SMALL LETTER E: э => dc 427Ü => Ü 428 429CYRILLIC SMALL LETTER SHCHA: щ => dd 430Ý => Ý 431 432CYRILLIC SMALL LETTER CHE: ч => de 433Þ => Þ 434 435CYRILLIC SMALL LETTER HARD SIGN: ъ => df 436ß => ß 437 438CYRILLIC CAPITAL LETTER YU: Ю => e0 439à => à 440 441CYRILLIC CAPITAL LETTER A: А => e1 442á => á 443 444CYRILLIC CAPITAL LETTER BE: Б => e2 445â => â 446 447CYRILLIC CAPITAL LETTER TSE: Ц => e3 448ã => ã 449 450CYRILLIC CAPITAL LETTER DE: Д => e4 451ä => ä 452 453CYRILLIC CAPITAL LETTER IE: Е => e5 454å => å 455 456CYRILLIC CAPITAL LETTER EF: Ф => e6 457æ => æ 458 459CYRILLIC CAPITAL LETTER GHE: Г => e7 460ç => ç 461 462CYRILLIC CAPITAL LETTER HA: Х => e8 463è => è 464 465CYRILLIC CAPITAL LETTER I: И => e9 466é => é 467 468CYRILLIC CAPITAL LETTER SHORT I: Й => ea 469ê => ê 470 471CYRILLIC CAPITAL LETTER KA: К => eb 472ë => ë 473 474CYRILLIC CAPITAL LETTER EL: Л => ec 475ì => ì 476 477CYRILLIC CAPITAL LETTER EM: М => ed 478í => í 479 480CYRILLIC CAPITAL LETTER EN: Н => ee 481î => î 482 483CYRILLIC CAPITAL LETTER O: О => ef 484ï => ï 485 486CYRILLIC CAPITAL LETTER PE: П => f0 487ð => ð 488 489CYRILLIC CAPITAL LETTER YA: Я => f1 490ñ => ñ 491 492CYRILLIC CAPITAL LETTER ER: Р => f2 493ò => ò 494 495CYRILLIC CAPITAL LETTER ES: С => f3 496ó => ó 497 498CYRILLIC CAPITAL LETTER TE: Т => f4 499ô => ô 500 501CYRILLIC CAPITAL LETTER U: У => f5 502õ => õ 503 504CYRILLIC CAPITAL LETTER ZHE: Ж => f6 505ö => ö 506 507CYRILLIC CAPITAL LETTER VE: В => f7 508÷ => 9f 509 510CYRILLIC CAPITAL LETTER SOFT SIGN: Ь => f8 511ø => ø 512 513CYRILLIC CAPITAL LETTER YERU: Ы => f9 514ù => ù 515 516CYRILLIC CAPITAL LETTER ZE: З => fa 517ú => ú 518 519CYRILLIC CAPITAL LETTER SHA: Ш => fb 520û => û 521 522CYRILLIC CAPITAL LETTER E: Э => fc 523ü => ü 524 525CYRILLIC CAPITAL LETTER SHCHA: Щ => fd 526ý => ý 527 528CYRILLIC CAPITAL LETTER CHE: Ч => fe 529þ => þ 530 531CYRILLIC CAPITAL LETTER HARD SIGN: Ъ => ff 532ÿ => ÿ 533