1--TEST-- 2Translation of HTML entities for encoding ISO-8859-15 3--FILE-- 4<?php 5$arr = array( 60x00A0 => array(0xA0, "NO-BREAK SPACE"), 70x00A1 => array(0xA1, "INVERTED EXCLAMATION MARK"), 80x00A2 => array(0xA2, "CENT SIGN"), 90x00A3 => array(0xA3, "POUND SIGN"), 100x20AC => array(0xA4, "EURO SIGN"), 110x00A5 => array(0xA5, "YEN SIGN"), 120x0160 => array(0xA6, "LATIN CAPITAL LETTER S WITH CARON"), 130x00A7 => array(0xA7, "SECTION SIGN"), 140x0161 => array(0xA8, "LATIN SMALL LETTER S WITH CARON"), 150x00A9 => array(0xA9, "COPYRIGHT SIGN"), 160x00AA => array(0xAA, "FEMININE ORDINAL INDICATOR"), 170x00AB => array(0xAB, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"), 180x00AC => array(0xAC, "NOT SIGN"), 190x00AD => array(0xAD, "SOFT HYPHEN"), 200x00AE => array(0xAE, "REGISTERED SIGN"), 210x00AF => array(0xAF, "MACRON"), 220x00B0 => array(0xB0, "DEGREE SIGN"), 230x00B1 => array(0xB1, "PLUS-MINUS SIGN"), 240x00B2 => array(0xB2, "SUPERSCRIPT TWO"), 250x00B3 => array(0xB3, "SUPERSCRIPT THREE"), 260x017D => array(0xB4, "LATIN CAPITAL LETTER Z WITH CARON"), 270x00B5 => array(0xB5, "MICRO SIGN"), 280x00B6 => array(0xB6, "PILCROW SIGN"), 290x00B7 => array(0xB7, "MIDDLE DOT"), 300x017E => array(0xB8, "LATIN SMALL LETTER Z WITH CARON"), 310x00B9 => array(0xB9, "SUPERSCRIPT ONE"), 320x00BA => array(0xBA, "MASCULINE ORDINAL INDICATOR"), 330x00BB => array(0xBB, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"), 340x0152 => array(0xBC, "LATIN CAPITAL LIGATURE OE"), 350x0153 => array(0xBD, "LATIN SMALL LIGATURE OE"), 360x0178 => array(0xBE, "LATIN CAPITAL LETTER Y WITH DIAERESIS"), 370x00BF => array(0xBF, "INVERTED QUESTION MARK"), 380x00C0 => array(0xC0, "LATIN CAPITAL LETTER A WITH GRAVE"), 390x00C1 => array(0xC1, "LATIN CAPITAL LETTER A WITH ACUTE"), 400x00C2 => array(0xC2, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"), 410x00C3 => array(0xC3, "LATIN CAPITAL LETTER A WITH TILDE"), 420x00C4 => array(0xC4, "LATIN CAPITAL LETTER A WITH DIAERESIS"), 430x00C5 => array(0xC5, "LATIN CAPITAL LETTER A WITH RING ABOVE"), 440x00C6 => array(0xC6, "LATIN CAPITAL LETTER AE"), 450x00C7 => array(0xC7, "LATIN CAPITAL LETTER C WITH CEDILLA"), 460x00C8 => array(0xC8, "LATIN CAPITAL LETTER E WITH GRAVE"), 470x00C9 => array(0xC9, "LATIN CAPITAL LETTER E WITH ACUTE"), 480x00CA => array(0xCA, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"), 490x00CB => array(0xCB, "LATIN CAPITAL LETTER E WITH DIAERESIS"), 500x00CC => array(0xCC, "LATIN CAPITAL LETTER I WITH GRAVE"), 510x00CD => array(0xCD, "LATIN CAPITAL LETTER I WITH ACUTE"), 520x00CE => array(0xCE, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"), 530x00CF => array(0xCF, "LATIN CAPITAL LETTER I WITH DIAERESIS"), 540x00D0 => array(0xD0, "LATIN CAPITAL LETTER ETH"), 550x00D1 => array(0xD1, "LATIN CAPITAL LETTER N WITH TILDE"), 560x00D2 => array(0xD2, "LATIN CAPITAL LETTER O WITH GRAVE"), 570x00D3 => array(0xD3, "LATIN CAPITAL LETTER O WITH ACUTE"), 580x00D4 => array(0xD4, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"), 590x00D5 => array(0xD5, "LATIN CAPITAL LETTER O WITH TILDE"), 600x00D6 => array(0xD6, "LATIN CAPITAL LETTER O WITH DIAERESIS"), 610x00D7 => array(0xD7, "MULTIPLICATION SIGN"), 620x00D8 => array(0xD8, "LATIN CAPITAL LETTER O WITH STROKE"), 630x00D9 => array(0xD9, "LATIN CAPITAL LETTER U WITH GRAVE"), 640x00DA => array(0xDA, "LATIN CAPITAL LETTER U WITH ACUTE"), 650x00DB => array(0xDB, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"), 660x00DC => array(0xDC, "LATIN CAPITAL LETTER U WITH DIAERESIS"), 670x00DD => array(0xDD, "LATIN CAPITAL LETTER Y WITH ACUTE"), 680x00DE => array(0xDE, "LATIN CAPITAL LETTER THORN"), 690x00DF => array(0xDF, "LATIN SMALL LETTER SHARP S"), 700x00E0 => array(0xE0, "LATIN SMALL LETTER A WITH GRAVE"), 710x00E1 => array(0xE1, "LATIN SMALL LETTER A WITH ACUTE"), 720x00E2 => array(0xE2, "LATIN SMALL LETTER A WITH CIRCUMFLEX"), 730x00E3 => array(0xE3, "LATIN SMALL LETTER A WITH TILDE"), 740x00E4 => array(0xE4, "LATIN SMALL LETTER A WITH DIAERESIS"), 750x00E5 => array(0xE5, "LATIN SMALL LETTER A WITH RING ABOVE"), 760x00E6 => array(0xE6, "LATIN SMALL LETTER AE"), 770x00E7 => array(0xE7, "LATIN SMALL LETTER C WITH CEDILLA"), 780x00E8 => array(0xE8, "LATIN SMALL LETTER E WITH GRAVE"), 790x00E9 => array(0xE9, "LATIN SMALL LETTER E WITH ACUTE"), 800x00EA => array(0xEA, "LATIN SMALL LETTER E WITH CIRCUMFLEX"), 810x00EB => array(0xEB, "LATIN SMALL LETTER E WITH DIAERESIS"), 820x00EC => array(0xEC, "LATIN SMALL LETTER I WITH GRAVE"), 830x00ED => array(0xED, "LATIN SMALL LETTER I WITH ACUTE"), 840x00EE => array(0xEE, "LATIN SMALL LETTER I WITH CIRCUMFLEX"), 850x00EF => array(0xEF, "LATIN SMALL LETTER I WITH DIAERESIS"), 860x00F0 => array(0xF0, "LATIN SMALL LETTER ETH"), 870x00F1 => array(0xF1, "LATIN SMALL LETTER N WITH TILDE"), 880x00F2 => array(0xF2, "LATIN SMALL LETTER O WITH GRAVE"), 890x00F3 => array(0xF3, "LATIN SMALL LETTER O WITH ACUTE"), 900x00F4 => array(0xF4, "LATIN SMALL LETTER O WITH CIRCUMFLEX"), 910x00F5 => array(0xF5, "LATIN SMALL LETTER O WITH TILDE"), 920x00F6 => array(0xF6, "LATIN SMALL LETTER O WITH DIAERESIS"), 930x00F7 => array(0xF7, "DIVISION SIGN"), 940x00F8 => array(0xF8, "LATIN SMALL LETTER O WITH STROKE"), 950x00F9 => array(0xF9, "LATIN SMALL LETTER U WITH GRAVE"), 960x00FA => array(0xFA, "LATIN SMALL LETTER U WITH ACUTE"), 970x00FB => array(0xFB, "LATIN SMALL LETTER U WITH CIRCUMFLEX"), 980x00FC => array(0xFC, "LATIN SMALL LETTER U WITH DIAERESIS"), 990x00FD => array(0xFD, "LATIN SMALL LETTER Y WITH ACUTE"), 1000x00FE => array(0xFE, "LATIN SMALL LETTER THORN"), 1010x00FF => array(0xFF, "LATIN SMALL LETTER Y WITH DIAERESIS"), 102); 103 104foreach ($arr as $u => $v) { 105 $ent = sprintf("&#x%X;", $u); 106 $res = html_entity_decode($ent, ENT_QUOTES, 'ISO-8859-15'); 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-15'); 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 121INVERTED EXCLAMATION MARK: ¡ => a1 122¡ => a1 123 124CENT SIGN: ¢ => a2 125¢ => a2 126 127POUND SIGN: £ => a3 128£ => a3 129 130EURO SIGN: € => a4 131¤ => ¤ 132 133YEN SIGN: ¥ => a5 134¥ => a5 135 136LATIN CAPITAL LETTER S WITH CARON: Š => a6 137¦ => ¦ 138 139SECTION SIGN: § => a7 140§ => a7 141 142LATIN SMALL LETTER S WITH CARON: š => a8 143¨ => ¨ 144 145COPYRIGHT SIGN: © => a9 146© => a9 147 148FEMININE ORDINAL INDICATOR: ª => aa 149ª => aa 150 151LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => ab 152« => ab 153 154NOT SIGN: ¬ => ac 155¬ => ac 156 157SOFT HYPHEN: ­ => ad 158­ => ad 159 160REGISTERED SIGN: ® => ae 161® => ae 162 163MACRON: ¯ => af 164¯ => af 165 166DEGREE SIGN: ° => b0 167° => b0 168 169PLUS-MINUS SIGN: ± => b1 170± => b1 171 172SUPERSCRIPT TWO: ² => b2 173² => b2 174 175SUPERSCRIPT THREE: ³ => b3 176³ => b3 177 178LATIN CAPITAL LETTER Z WITH CARON: Ž => b4 179´ => ´ 180 181MICRO SIGN: µ => b5 182µ => b5 183 184PILCROW SIGN: ¶ => b6 185¶ => b6 186 187MIDDLE DOT: · => b7 188· => b7 189 190LATIN SMALL LETTER Z WITH CARON: ž => b8 191¸ => ¸ 192 193SUPERSCRIPT ONE: ¹ => b9 194¹ => b9 195 196MASCULINE ORDINAL INDICATOR: º => ba 197º => ba 198 199RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => bb 200» => bb 201 202LATIN CAPITAL LIGATURE OE: Œ => bc 203¼ => ¼ 204 205LATIN SMALL LIGATURE OE: œ => bd 206½ => ½ 207 208LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => be 209¾ => ¾ 210 211INVERTED QUESTION MARK: ¿ => bf 212¿ => bf 213 214LATIN CAPITAL LETTER A WITH GRAVE: À => c0 215À => c0 216 217LATIN CAPITAL LETTER A WITH ACUTE: Á => c1 218Á => c1 219 220LATIN CAPITAL LETTER A WITH CIRCUMFLEX:  => c2 221 => c2 222 223LATIN CAPITAL LETTER A WITH TILDE: à => c3 224à => c3 225 226LATIN CAPITAL LETTER A WITH DIAERESIS: Ä => c4 227Ä => c4 228 229LATIN CAPITAL LETTER A WITH RING ABOVE: Å => c5 230Å => c5 231 232LATIN CAPITAL LETTER AE: Æ => c6 233Æ => c6 234 235LATIN CAPITAL LETTER C WITH CEDILLA: Ç => c7 236Ç => c7 237 238LATIN CAPITAL LETTER E WITH GRAVE: È => c8 239È => c8 240 241LATIN CAPITAL LETTER E WITH ACUTE: É => c9 242É => c9 243 244LATIN CAPITAL LETTER E WITH CIRCUMFLEX: Ê => ca 245Ê => ca 246 247LATIN CAPITAL LETTER E WITH DIAERESIS: Ë => cb 248Ë => cb 249 250LATIN CAPITAL LETTER I WITH GRAVE: Ì => cc 251Ì => cc 252 253LATIN CAPITAL LETTER I WITH ACUTE: Í => cd 254Í => cd 255 256LATIN CAPITAL LETTER I WITH CIRCUMFLEX: Î => ce 257Î => ce 258 259LATIN CAPITAL LETTER I WITH DIAERESIS: Ï => cf 260Ï => cf 261 262LATIN CAPITAL LETTER ETH: Ð => d0 263Ð => d0 264 265LATIN CAPITAL LETTER N WITH TILDE: Ñ => d1 266Ñ => d1 267 268LATIN CAPITAL LETTER O WITH GRAVE: Ò => d2 269Ò => d2 270 271LATIN CAPITAL LETTER O WITH ACUTE: Ó => d3 272Ó => d3 273 274LATIN CAPITAL LETTER O WITH CIRCUMFLEX: Ô => d4 275Ô => d4 276 277LATIN CAPITAL LETTER O WITH TILDE: Õ => d5 278Õ => d5 279 280LATIN CAPITAL LETTER O WITH DIAERESIS: Ö => d6 281Ö => d6 282 283MULTIPLICATION SIGN: × => d7 284× => d7 285 286LATIN CAPITAL LETTER O WITH STROKE: Ø => d8 287Ø => d8 288 289LATIN CAPITAL LETTER U WITH GRAVE: Ù => d9 290Ù => d9 291 292LATIN CAPITAL LETTER U WITH ACUTE: Ú => da 293Ú => da 294 295LATIN CAPITAL LETTER U WITH CIRCUMFLEX: Û => db 296Û => db 297 298LATIN CAPITAL LETTER U WITH DIAERESIS: Ü => dc 299Ü => dc 300 301LATIN CAPITAL LETTER Y WITH ACUTE: Ý => dd 302Ý => dd 303 304LATIN CAPITAL LETTER THORN: Þ => de 305Þ => de 306 307LATIN SMALL LETTER SHARP S: ß => df 308ß => df 309 310LATIN SMALL LETTER A WITH GRAVE: à => e0 311à => e0 312 313LATIN SMALL LETTER A WITH ACUTE: á => e1 314á => e1 315 316LATIN SMALL LETTER A WITH CIRCUMFLEX: â => e2 317â => e2 318 319LATIN SMALL LETTER A WITH TILDE: ã => e3 320ã => e3 321 322LATIN SMALL LETTER A WITH DIAERESIS: ä => e4 323ä => e4 324 325LATIN SMALL LETTER A WITH RING ABOVE: å => e5 326å => e5 327 328LATIN SMALL LETTER AE: æ => e6 329æ => e6 330 331LATIN SMALL LETTER C WITH CEDILLA: ç => e7 332ç => e7 333 334LATIN SMALL LETTER E WITH GRAVE: è => e8 335è => e8 336 337LATIN SMALL LETTER E WITH ACUTE: é => e9 338é => e9 339 340LATIN SMALL LETTER E WITH CIRCUMFLEX: ê => ea 341ê => ea 342 343LATIN SMALL LETTER E WITH DIAERESIS: ë => eb 344ë => eb 345 346LATIN SMALL LETTER I WITH GRAVE: ì => ec 347ì => ec 348 349LATIN SMALL LETTER I WITH ACUTE: í => ed 350í => ed 351 352LATIN SMALL LETTER I WITH CIRCUMFLEX: î => ee 353î => ee 354 355LATIN SMALL LETTER I WITH DIAERESIS: ï => ef 356ï => ef 357 358LATIN SMALL LETTER ETH: ð => f0 359ð => f0 360 361LATIN SMALL LETTER N WITH TILDE: ñ => f1 362ñ => f1 363 364LATIN SMALL LETTER O WITH GRAVE: ò => f2 365ò => f2 366 367LATIN SMALL LETTER O WITH ACUTE: ó => f3 368ó => f3 369 370LATIN SMALL LETTER O WITH CIRCUMFLEX: ô => f4 371ô => f4 372 373LATIN SMALL LETTER O WITH TILDE: õ => f5 374õ => f5 375 376LATIN SMALL LETTER O WITH DIAERESIS: ö => f6 377ö => f6 378 379DIVISION SIGN: ÷ => f7 380÷ => f7 381 382LATIN SMALL LETTER O WITH STROKE: ø => f8 383ø => f8 384 385LATIN SMALL LETTER U WITH GRAVE: ù => f9 386ù => f9 387 388LATIN SMALL LETTER U WITH ACUTE: ú => fa 389ú => fa 390 391LATIN SMALL LETTER U WITH CIRCUMFLEX: û => fb 392û => fb 393 394LATIN SMALL LETTER U WITH DIAERESIS: ü => fc 395ü => fc 396 397LATIN SMALL LETTER Y WITH ACUTE: ý => fd 398ý => fd 399 400LATIN SMALL LETTER THORN: þ => fe 401þ => fe 402 403LATIN SMALL LETTER Y WITH DIAERESIS: ÿ => ff 404ÿ => ff 405