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--EXPECT-- 117NO-BREAK SPACE:   => a0 118  => a0 119 120INVERTED EXCLAMATION MARK: ¡ => a1 121¡ => a1 122 123CENT SIGN: ¢ => a2 124¢ => a2 125 126POUND SIGN: £ => a3 127£ => a3 128 129EURO SIGN: € => a4 130¤ => ¤ 131 132YEN SIGN: ¥ => a5 133¥ => a5 134 135LATIN CAPITAL LETTER S WITH CARON: Š => a6 136¦ => ¦ 137 138SECTION SIGN: § => a7 139§ => a7 140 141LATIN SMALL LETTER S WITH CARON: š => a8 142¨ => ¨ 143 144COPYRIGHT SIGN: © => a9 145© => a9 146 147FEMININE ORDINAL INDICATOR: ª => aa 148ª => aa 149 150LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => ab 151« => ab 152 153NOT SIGN: ¬ => ac 154¬ => ac 155 156SOFT HYPHEN: ­ => ad 157­ => ad 158 159REGISTERED SIGN: ® => ae 160® => ae 161 162MACRON: ¯ => af 163¯ => af 164 165DEGREE SIGN: ° => b0 166° => b0 167 168PLUS-MINUS SIGN: ± => b1 169± => b1 170 171SUPERSCRIPT TWO: ² => b2 172² => b2 173 174SUPERSCRIPT THREE: ³ => b3 175³ => b3 176 177LATIN CAPITAL LETTER Z WITH CARON: Ž => b4 178´ => ´ 179 180MICRO SIGN: µ => b5 181µ => b5 182 183PILCROW SIGN: ¶ => b6 184¶ => b6 185 186MIDDLE DOT: · => b7 187· => b7 188 189LATIN SMALL LETTER Z WITH CARON: ž => b8 190¸ => ¸ 191 192SUPERSCRIPT ONE: ¹ => b9 193¹ => b9 194 195MASCULINE ORDINAL INDICATOR: º => ba 196º => ba 197 198RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => bb 199» => bb 200 201LATIN CAPITAL LIGATURE OE: Œ => bc 202¼ => ¼ 203 204LATIN SMALL LIGATURE OE: œ => bd 205½ => ½ 206 207LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => be 208¾ => ¾ 209 210INVERTED QUESTION MARK: ¿ => bf 211¿ => bf 212 213LATIN CAPITAL LETTER A WITH GRAVE: À => c0 214À => c0 215 216LATIN CAPITAL LETTER A WITH ACUTE: Á => c1 217Á => c1 218 219LATIN CAPITAL LETTER A WITH CIRCUMFLEX:  => c2 220 => c2 221 222LATIN CAPITAL LETTER A WITH TILDE: à => c3 223à => c3 224 225LATIN CAPITAL LETTER A WITH DIAERESIS: Ä => c4 226Ä => c4 227 228LATIN CAPITAL LETTER A WITH RING ABOVE: Å => c5 229Å => c5 230 231LATIN CAPITAL LETTER AE: Æ => c6 232Æ => c6 233 234LATIN CAPITAL LETTER C WITH CEDILLA: Ç => c7 235Ç => c7 236 237LATIN CAPITAL LETTER E WITH GRAVE: È => c8 238È => c8 239 240LATIN CAPITAL LETTER E WITH ACUTE: É => c9 241É => c9 242 243LATIN CAPITAL LETTER E WITH CIRCUMFLEX: Ê => ca 244Ê => ca 245 246LATIN CAPITAL LETTER E WITH DIAERESIS: Ë => cb 247Ë => cb 248 249LATIN CAPITAL LETTER I WITH GRAVE: Ì => cc 250Ì => cc 251 252LATIN CAPITAL LETTER I WITH ACUTE: Í => cd 253Í => cd 254 255LATIN CAPITAL LETTER I WITH CIRCUMFLEX: Î => ce 256Î => ce 257 258LATIN CAPITAL LETTER I WITH DIAERESIS: Ï => cf 259Ï => cf 260 261LATIN CAPITAL LETTER ETH: Ð => d0 262Ð => d0 263 264LATIN CAPITAL LETTER N WITH TILDE: Ñ => d1 265Ñ => d1 266 267LATIN CAPITAL LETTER O WITH GRAVE: Ò => d2 268Ò => d2 269 270LATIN CAPITAL LETTER O WITH ACUTE: Ó => d3 271Ó => d3 272 273LATIN CAPITAL LETTER O WITH CIRCUMFLEX: Ô => d4 274Ô => d4 275 276LATIN CAPITAL LETTER O WITH TILDE: Õ => d5 277Õ => d5 278 279LATIN CAPITAL LETTER O WITH DIAERESIS: Ö => d6 280Ö => d6 281 282MULTIPLICATION SIGN: × => d7 283× => d7 284 285LATIN CAPITAL LETTER O WITH STROKE: Ø => d8 286Ø => d8 287 288LATIN CAPITAL LETTER U WITH GRAVE: Ù => d9 289Ù => d9 290 291LATIN CAPITAL LETTER U WITH ACUTE: Ú => da 292Ú => da 293 294LATIN CAPITAL LETTER U WITH CIRCUMFLEX: Û => db 295Û => db 296 297LATIN CAPITAL LETTER U WITH DIAERESIS: Ü => dc 298Ü => dc 299 300LATIN CAPITAL LETTER Y WITH ACUTE: Ý => dd 301Ý => dd 302 303LATIN CAPITAL LETTER THORN: Þ => de 304Þ => de 305 306LATIN SMALL LETTER SHARP S: ß => df 307ß => df 308 309LATIN SMALL LETTER A WITH GRAVE: à => e0 310à => e0 311 312LATIN SMALL LETTER A WITH ACUTE: á => e1 313á => e1 314 315LATIN SMALL LETTER A WITH CIRCUMFLEX: â => e2 316â => e2 317 318LATIN SMALL LETTER A WITH TILDE: ã => e3 319ã => e3 320 321LATIN SMALL LETTER A WITH DIAERESIS: ä => e4 322ä => e4 323 324LATIN SMALL LETTER A WITH RING ABOVE: å => e5 325å => e5 326 327LATIN SMALL LETTER AE: æ => e6 328æ => e6 329 330LATIN SMALL LETTER C WITH CEDILLA: ç => e7 331ç => e7 332 333LATIN SMALL LETTER E WITH GRAVE: è => e8 334è => e8 335 336LATIN SMALL LETTER E WITH ACUTE: é => e9 337é => e9 338 339LATIN SMALL LETTER E WITH CIRCUMFLEX: ê => ea 340ê => ea 341 342LATIN SMALL LETTER E WITH DIAERESIS: ë => eb 343ë => eb 344 345LATIN SMALL LETTER I WITH GRAVE: ì => ec 346ì => ec 347 348LATIN SMALL LETTER I WITH ACUTE: í => ed 349í => ed 350 351LATIN SMALL LETTER I WITH CIRCUMFLEX: î => ee 352î => ee 353 354LATIN SMALL LETTER I WITH DIAERESIS: ï => ef 355ï => ef 356 357LATIN SMALL LETTER ETH: ð => f0 358ð => f0 359 360LATIN SMALL LETTER N WITH TILDE: ñ => f1 361ñ => f1 362 363LATIN SMALL LETTER O WITH GRAVE: ò => f2 364ò => f2 365 366LATIN SMALL LETTER O WITH ACUTE: ó => f3 367ó => f3 368 369LATIN SMALL LETTER O WITH CIRCUMFLEX: ô => f4 370ô => f4 371 372LATIN SMALL LETTER O WITH TILDE: õ => f5 373õ => f5 374 375LATIN SMALL LETTER O WITH DIAERESIS: ö => f6 376ö => f6 377 378DIVISION SIGN: ÷ => f7 379÷ => f7 380 381LATIN SMALL LETTER O WITH STROKE: ø => f8 382ø => f8 383 384LATIN SMALL LETTER U WITH GRAVE: ù => f9 385ù => f9 386 387LATIN SMALL LETTER U WITH ACUTE: ú => fa 388ú => fa 389 390LATIN SMALL LETTER U WITH CIRCUMFLEX: û => fb 391û => fb 392 393LATIN SMALL LETTER U WITH DIAERESIS: ü => fc 394ü => fc 395 396LATIN SMALL LETTER Y WITH ACUTE: ý => fd 397ý => fd 398 399LATIN SMALL LETTER THORN: þ => fe 400þ => fe 401 402LATIN SMALL LETTER Y WITH DIAERESIS: ÿ => ff 403ÿ => ff 404