1--TEST-- 2Translation of HTML entities for encoding MacRoman 3--FILE-- 4<?php 5$arr = array( 60x00C4 => array(0x80, "LATIN CAPITAL LETTER A WITH DIAERESIS"), 70x00C5 => array(0x81, "LATIN CAPITAL LETTER A WITH RING ABOVE"), 80x00C7 => array(0x82, "LATIN CAPITAL LETTER C WITH CEDILLA"), 90x00C9 => array(0x83, "LATIN CAPITAL LETTER E WITH ACUTE"), 100x00D1 => array(0x84, "LATIN CAPITAL LETTER N WITH TILDE"), 110x00D6 => array(0x85, "LATIN CAPITAL LETTER O WITH DIAERESIS"), 120x00DC => array(0x86, "LATIN CAPITAL LETTER U WITH DIAERESIS"), 130x00E1 => array(0x87, "LATIN SMALL LETTER A WITH ACUTE"), 140x00E0 => array(0x88, "LATIN SMALL LETTER A WITH GRAVE"), 150x00E2 => array(0x89, "LATIN SMALL LETTER A WITH CIRCUMFLEX"), 160x00E4 => array(0x8A, "LATIN SMALL LETTER A WITH DIAERESIS"), 170x00E3 => array(0x8B, "LATIN SMALL LETTER A WITH TILDE"), 180x00E5 => array(0x8C, "LATIN SMALL LETTER A WITH RING ABOVE"), 190x00E7 => array(0x8D, "LATIN SMALL LETTER C WITH CEDILLA"), 200x00E9 => array(0x8E, "LATIN SMALL LETTER E WITH ACUTE"), 210x00E8 => array(0x8F, "LATIN SMALL LETTER E WITH GRAVE"), 220x00EA => array(0x90, "LATIN SMALL LETTER E WITH CIRCUMFLEX"), 230x00EB => array(0x91, "LATIN SMALL LETTER E WITH DIAERESIS"), 240x00ED => array(0x92, "LATIN SMALL LETTER I WITH ACUTE"), 250x00EC => array(0x93, "LATIN SMALL LETTER I WITH GRAVE"), 260x00EE => array(0x94, "LATIN SMALL LETTER I WITH CIRCUMFLEX"), 270x00EF => array(0x95, "LATIN SMALL LETTER I WITH DIAERESIS"), 280x00F1 => array(0x96, "LATIN SMALL LETTER N WITH TILDE"), 290x00F3 => array(0x97, "LATIN SMALL LETTER O WITH ACUTE"), 300x00F2 => array(0x98, "LATIN SMALL LETTER O WITH GRAVE"), 310x00F4 => array(0x99, "LATIN SMALL LETTER O WITH CIRCUMFLEX"), 320x00F6 => array(0x9A, "LATIN SMALL LETTER O WITH DIAERESIS"), 330x00F5 => array(0x9B, "LATIN SMALL LETTER O WITH TILDE"), 340x00FA => array(0x9C, "LATIN SMALL LETTER U WITH ACUTE"), 350x00F9 => array(0x9D, "LATIN SMALL LETTER U WITH GRAVE"), 360x00FB => array(0x9E, "LATIN SMALL LETTER U WITH CIRCUMFLEX"), 370x00FC => array(0x9F, "LATIN SMALL LETTER U WITH DIAERESIS"), 380x2020 => array(0xA0, "DAGGER"), 390x00B0 => array(0xA1, "DEGREE SIGN"), 400x00A2 => array(0xA2, "CENT SIGN"), 410x00A3 => array(0xA3, "POUND SIGN"), 420x00A7 => array(0xA4, "SECTION SIGN"), 430x2022 => array(0xA5, "BULLET"), 440x00B6 => array(0xA6, "PILCROW SIGN"), 450x00DF => array(0xA7, "LATIN SMALL LETTER SHARP S"), 460x00AE => array(0xA8, "REGISTERED SIGN"), 470x00A9 => array(0xA9, "COPYRIGHT SIGN"), 480x2122 => array(0xAA, "TRADE MARK SIGN"), 490x00B4 => array(0xAB, "ACUTE ACCENT"), 500x00A8 => array(0xAC, "DIAERESIS"), 510x2260 => array(0xAD, "NOT EQUAL TO"), 520x00C6 => array(0xAE, "LATIN CAPITAL LETTER AE"), 530x00D8 => array(0xAF, "LATIN CAPITAL LETTER O WITH STROKE"), 540x221E => array(0xB0, "INFINITY"), 550x00B1 => array(0xB1, "PLUS-MINUS SIGN"), 560x2264 => array(0xB2, "LESS-THAN OR EQUAL TO"), 570x2265 => array(0xB3, "GREATER-THAN OR EQUAL TO"), 580x00A5 => array(0xB4, "YEN SIGN"), 590x00B5 => array(0xB5, "MICRO SIGN"), 600x2202 => array(0xB6, "PARTIAL DIFFERENTIAL"), 610x2211 => array(0xB7, "N-ARY SUMMATION"), 620x220F => array(0xB8, "N-ARY PRODUCT"), 630x03C0 => array(0xB9, "GREEK SMALL LETTER PI"), 640x222B => array(0xBA, "INTEGRAL"), 650x00AA => array(0xBB, "FEMININE ORDINAL INDICATOR"), 660x00BA => array(0xBC, "MASCULINE ORDINAL INDICATOR"), 670x03A9 => array(0xBD, "GREEK CAPITAL LETTER OMEGA"), 680x00E6 => array(0xBE, "LATIN SMALL LETTER AE"), 690x00F8 => array(0xBF, "LATIN SMALL LETTER O WITH STROKE"), 700x00BF => array(0xC0, "INVERTED QUESTION MARK"), 710x00A1 => array(0xC1, "INVERTED EXCLAMATION MARK"), 720x00AC => array(0xC2, "NOT SIGN"), 730x221A => array(0xC3, "SQUARE ROOT"), 740x0192 => array(0xC4, "LATIN SMALL LETTER F WITH HOOK"), 750x2248 => array(0xC5, "ALMOST EQUAL TO"), 760x2206 => array(0xC6, "INCREMENT"), 770x00AB => array(0xC7, "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK"), 780x00BB => array(0xC8, "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK"), 790x2026 => array(0xC9, "HORIZONTAL ELLIPSIS"), 800x00A0 => array(0xCA, "NO-BREAK SPACE"), 810x00C0 => array(0xCB, "LATIN CAPITAL LETTER A WITH GRAVE"), 820x00C3 => array(0xCC, "LATIN CAPITAL LETTER A WITH TILDE"), 830x00D5 => array(0xCD, "LATIN CAPITAL LETTER O WITH TILDE"), 840x0152 => array(0xCE, "LATIN CAPITAL LIGATURE OE"), 850x0153 => array(0xCF, "LATIN SMALL LIGATURE OE"), 860x2013 => array(0xD0, "EN DASH"), 870x2014 => array(0xD1, "EM DASH"), 880x201C => array(0xD2, "LEFT DOUBLE QUOTATION MARK"), 890x201D => array(0xD3, "RIGHT DOUBLE QUOTATION MARK"), 900x2018 => array(0xD4, "LEFT SINGLE QUOTATION MARK"), 910x2019 => array(0xD5, "RIGHT SINGLE QUOTATION MARK"), 920x00F7 => array(0xD6, "DIVISION SIGN"), 930x25CA => array(0xD7, "LOZENGE"), 940x00FF => array(0xD8, "LATIN SMALL LETTER Y WITH DIAERESIS"), 950x0178 => array(0xD9, "LATIN CAPITAL LETTER Y WITH DIAERESIS"), 960x2044 => array(0xDA, "FRACTION SLASH"), 970x20AC => array(0xDB, "EURO SIGN"), 980x2039 => array(0xDC, "SINGLE LEFT-POINTING ANGLE QUOTATION MARK"), 990x203A => array(0xDD, "SINGLE RIGHT-POINTING ANGLE QUOTATION MARK"), 1000xFB01 => array(0xDE, "LATIN SMALL LIGATURE FI"), 1010xFB02 => array(0xDF, "LATIN SMALL LIGATURE FL"), 1020x2021 => array(0xE0, "DOUBLE DAGGER"), 1030x00B7 => array(0xE1, "MIDDLE DOT"), 1040x201A => array(0xE2, "SINGLE LOW-9 QUOTATION MARK"), 1050x201E => array(0xE3, "DOUBLE LOW-9 QUOTATION MARK"), 1060x2030 => array(0xE4, "PER MILLE SIGN"), 1070x00C2 => array(0xE5, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX"), 1080x00CA => array(0xE6, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX"), 1090x00C1 => array(0xE7, "LATIN CAPITAL LETTER A WITH ACUTE"), 1100x00CB => array(0xE8, "LATIN CAPITAL LETTER E WITH DIAERESIS"), 1110x00C8 => array(0xE9, "LATIN CAPITAL LETTER E WITH GRAVE"), 1120x00CD => array(0xEA, "LATIN CAPITAL LETTER I WITH ACUTE"), 1130x00CE => array(0xEB, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX"), 1140x00CF => array(0xEC, "LATIN CAPITAL LETTER I WITH DIAERESIS"), 1150x00CC => array(0xED, "LATIN CAPITAL LETTER I WITH GRAVE"), 1160x00D3 => array(0xEE, "LATIN CAPITAL LETTER O WITH ACUTE"), 1170x00D4 => array(0xEF, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX"), 1180xF8FF => array(0xF0, "Apple logo"), 1190x00D2 => array(0xF1, "LATIN CAPITAL LETTER O WITH GRAVE"), 1200x00DA => array(0xF2, "LATIN CAPITAL LETTER U WITH ACUTE"), 1210x00DB => array(0xF3, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX"), 1220x00D9 => array(0xF4, "LATIN CAPITAL LETTER U WITH GRAVE"), 1230x0131 => array(0xF5, "LATIN SMALL LETTER DOTLESS I"), 1240x02C6 => array(0xF6, "MODIFIER LETTER CIRCUMFLEX ACCENT"), 1250x02DC => array(0xF7, "SMALL TILDE"), 1260x00AF => array(0xF8, "MACRON"), 1270x02D8 => array(0xF9, "BREVE"), 1280x02D9 => array(0xFA, "DOT ABOVE"), 1290x02DA => array(0xFB, "RING ABOVE"), 1300x00B8 => array(0xFC, "CEDILLA"), 1310x02DD => array(0xFD, "DOUBLE ACUTE ACCENT"), 1320x02DB => array(0xFE, "OGONEK"), 1330x02C7 => array(0xFF, "CARON"), 134); 135 136$res = html_entity_decode("", ENT_QUOTES, 'MacRoman'); 137echo "Special test for  (shouldn't decode):\n"; 138echo $res,"\n\n"; 139 140foreach ($arr as $u => $v) { 141 $ent = sprintf("&#x%X;", $u); 142 $res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman'); 143 $d = unpack("H*", $res); 144 echo sprintf("%s: %s => %s\n", $v[1], $ent, $d[1]); 145 146 $ent = sprintf("&#x%X;", $v[0]); 147 $res = html_entity_decode($ent, ENT_QUOTES, 'MacRoman'); 148 if ($res[0] != "&" || $res[1] != "#") 149 $res = unpack("H*", $res)[1]; 150 echo sprintf("%s => %s\n\n", $ent, $res); 151} 152?> 153--EXPECT-- 154Special test for  (shouldn't decode): 155 156 157LATIN CAPITAL LETTER A WITH DIAERESIS: Ä => 80 158€ => € 159 160LATIN CAPITAL LETTER A WITH RING ABOVE: Å => 81 161 =>  162 163LATIN CAPITAL LETTER C WITH CEDILLA: Ç => 82 164‚ => ‚ 165 166LATIN CAPITAL LETTER E WITH ACUTE: É => 83 167ƒ => ƒ 168 169LATIN CAPITAL LETTER N WITH TILDE: Ñ => 84 170„ => „ 171 172LATIN CAPITAL LETTER O WITH DIAERESIS: Ö => 85 173… => … 174 175LATIN CAPITAL LETTER U WITH DIAERESIS: Ü => 86 176† => † 177 178LATIN SMALL LETTER A WITH ACUTE: á => 87 179‡ => ‡ 180 181LATIN SMALL LETTER A WITH GRAVE: à => 88 182ˆ => ˆ 183 184LATIN SMALL LETTER A WITH CIRCUMFLEX: â => 89 185‰ => ‰ 186 187LATIN SMALL LETTER A WITH DIAERESIS: ä => 8a 188Š => Š 189 190LATIN SMALL LETTER A WITH TILDE: ã => 8b 191‹ => ‹ 192 193LATIN SMALL LETTER A WITH RING ABOVE: å => 8c 194Œ => Œ 195 196LATIN SMALL LETTER C WITH CEDILLA: ç => 8d 197 =>  198 199LATIN SMALL LETTER E WITH ACUTE: é => 8e 200Ž => Ž 201 202LATIN SMALL LETTER E WITH GRAVE: è => 8f 203 =>  204 205LATIN SMALL LETTER E WITH CIRCUMFLEX: ê => 90 206 =>  207 208LATIN SMALL LETTER E WITH DIAERESIS: ë => 91 209‘ => ‘ 210 211LATIN SMALL LETTER I WITH ACUTE: í => 92 212’ => ’ 213 214LATIN SMALL LETTER I WITH GRAVE: ì => 93 215“ => “ 216 217LATIN SMALL LETTER I WITH CIRCUMFLEX: î => 94 218” => ” 219 220LATIN SMALL LETTER I WITH DIAERESIS: ï => 95 221• => • 222 223LATIN SMALL LETTER N WITH TILDE: ñ => 96 224– => – 225 226LATIN SMALL LETTER O WITH ACUTE: ó => 97 227— => — 228 229LATIN SMALL LETTER O WITH GRAVE: ò => 98 230˜ => ˜ 231 232LATIN SMALL LETTER O WITH CIRCUMFLEX: ô => 99 233™ => ™ 234 235LATIN SMALL LETTER O WITH DIAERESIS: ö => 9a 236š => š 237 238LATIN SMALL LETTER O WITH TILDE: õ => 9b 239› => › 240 241LATIN SMALL LETTER U WITH ACUTE: ú => 9c 242œ => œ 243 244LATIN SMALL LETTER U WITH GRAVE: ù => 9d 245 =>  246 247LATIN SMALL LETTER U WITH CIRCUMFLEX: û => 9e 248ž => ž 249 250LATIN SMALL LETTER U WITH DIAERESIS: ü => 9f 251Ÿ => Ÿ 252 253DAGGER: † => a0 254  => ca 255 256DEGREE SIGN: ° => a1 257¡ => c1 258 259CENT SIGN: ¢ => a2 260¢ => a2 261 262POUND SIGN: £ => a3 263£ => a3 264 265SECTION SIGN: § => a4 266¤ => ¤ 267 268BULLET: • => a5 269¥ => b4 270 271PILCROW SIGN: ¶ => a6 272¦ => ¦ 273 274LATIN SMALL LETTER SHARP S: ß => a7 275§ => a4 276 277REGISTERED SIGN: ® => a8 278¨ => ac 279 280COPYRIGHT SIGN: © => a9 281© => a9 282 283TRADE MARK SIGN: ™ => aa 284ª => bb 285 286ACUTE ACCENT: ´ => ab 287« => c7 288 289DIAERESIS: ¨ => ac 290¬ => c2 291 292NOT EQUAL TO: ≠ => ad 293­ => ­ 294 295LATIN CAPITAL LETTER AE: Æ => ae 296® => a8 297 298LATIN CAPITAL LETTER O WITH STROKE: Ø => af 299¯ => f8 300 301INFINITY: ∞ => b0 302° => a1 303 304PLUS-MINUS SIGN: ± => b1 305± => b1 306 307LESS-THAN OR EQUAL TO: ≤ => b2 308² => ² 309 310GREATER-THAN OR EQUAL TO: ≥ => b3 311³ => ³ 312 313YEN SIGN: ¥ => b4 314´ => ab 315 316MICRO SIGN: µ => b5 317µ => b5 318 319PARTIAL DIFFERENTIAL: ∂ => b6 320¶ => a6 321 322N-ARY SUMMATION: ∑ => b7 323· => e1 324 325N-ARY PRODUCT: ∏ => b8 326¸ => fc 327 328GREEK SMALL LETTER PI: π => b9 329¹ => ¹ 330 331INTEGRAL: ∫ => ba 332º => bc 333 334FEMININE ORDINAL INDICATOR: ª => bb 335» => c8 336 337MASCULINE ORDINAL INDICATOR: º => bc 338¼ => ¼ 339 340GREEK CAPITAL LETTER OMEGA: Ω => bd 341½ => ½ 342 343LATIN SMALL LETTER AE: æ => be 344¾ => ¾ 345 346LATIN SMALL LETTER O WITH STROKE: ø => bf 347¿ => c0 348 349INVERTED QUESTION MARK: ¿ => c0 350À => cb 351 352INVERTED EXCLAMATION MARK: ¡ => c1 353Á => e7 354 355NOT SIGN: ¬ => c2 356 => e5 357 358SQUARE ROOT: √ => c3 359à => cc 360 361LATIN SMALL LETTER F WITH HOOK: ƒ => c4 362Ä => 80 363 364ALMOST EQUAL TO: ≈ => c5 365Å => 81 366 367INCREMENT: ∆ => c6 368Æ => ae 369 370LEFT-POINTING DOUBLE ANGLE QUOTATION MARK: « => c7 371Ç => 82 372 373RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK: » => c8 374È => e9 375 376HORIZONTAL ELLIPSIS: … => c9 377É => 83 378 379NO-BREAK SPACE:   => ca 380Ê => e6 381 382LATIN CAPITAL LETTER A WITH GRAVE: À => cb 383Ë => e8 384 385LATIN CAPITAL LETTER A WITH TILDE: à => cc 386Ì => ed 387 388LATIN CAPITAL LETTER O WITH TILDE: Õ => cd 389Í => ea 390 391LATIN CAPITAL LIGATURE OE: Œ => ce 392Î => eb 393 394LATIN SMALL LIGATURE OE: œ => cf 395Ï => ec 396 397EN DASH: – => d0 398Ð => Ð 399 400EM DASH: — => d1 401Ñ => 84 402 403LEFT DOUBLE QUOTATION MARK: “ => d2 404Ò => f1 405 406RIGHT DOUBLE QUOTATION MARK: ” => d3 407Ó => ee 408 409LEFT SINGLE QUOTATION MARK: ‘ => d4 410Ô => ef 411 412RIGHT SINGLE QUOTATION MARK: ’ => d5 413Õ => cd 414 415DIVISION SIGN: ÷ => d6 416Ö => 85 417 418LOZENGE: ◊ => d7 419× => × 420 421LATIN SMALL LETTER Y WITH DIAERESIS: ÿ => d8 422Ø => af 423 424LATIN CAPITAL LETTER Y WITH DIAERESIS: Ÿ => d9 425Ù => f4 426 427FRACTION SLASH: ⁄ => da 428Ú => f2 429 430EURO SIGN: € => db 431Û => f3 432 433SINGLE LEFT-POINTING ANGLE QUOTATION MARK: ‹ => dc 434Ü => 86 435 436SINGLE RIGHT-POINTING ANGLE QUOTATION MARK: › => dd 437Ý => Ý 438 439LATIN SMALL LIGATURE FI: fi => de 440Þ => Þ 441 442LATIN SMALL LIGATURE FL: fl => df 443ß => a7 444 445DOUBLE DAGGER: ‡ => e0 446à => 88 447 448MIDDLE DOT: · => e1 449á => 87 450 451SINGLE LOW-9 QUOTATION MARK: ‚ => e2 452â => 89 453 454DOUBLE LOW-9 QUOTATION MARK: „ => e3 455ã => 8b 456 457PER MILLE SIGN: ‰ => e4 458ä => 8a 459 460LATIN CAPITAL LETTER A WITH CIRCUMFLEX:  => e5 461å => 8c 462 463LATIN CAPITAL LETTER E WITH CIRCUMFLEX: Ê => e6 464æ => be 465 466LATIN CAPITAL LETTER A WITH ACUTE: Á => e7 467ç => 8d 468 469LATIN CAPITAL LETTER E WITH DIAERESIS: Ë => e8 470è => 8f 471 472LATIN CAPITAL LETTER E WITH GRAVE: È => e9 473é => 8e 474 475LATIN CAPITAL LETTER I WITH ACUTE: Í => ea 476ê => 90 477 478LATIN CAPITAL LETTER I WITH CIRCUMFLEX: Î => eb 479ë => 91 480 481LATIN CAPITAL LETTER I WITH DIAERESIS: Ï => ec 482ì => 93 483 484LATIN CAPITAL LETTER I WITH GRAVE: Ì => ed 485í => 92 486 487LATIN CAPITAL LETTER O WITH ACUTE: Ó => ee 488î => 94 489 490LATIN CAPITAL LETTER O WITH CIRCUMFLEX: Ô => ef 491ï => 95 492 493Apple logo:  => f0 494ð => ð 495 496LATIN CAPITAL LETTER O WITH GRAVE: Ò => f1 497ñ => 96 498 499LATIN CAPITAL LETTER U WITH ACUTE: Ú => f2 500ò => 98 501 502LATIN CAPITAL LETTER U WITH CIRCUMFLEX: Û => f3 503ó => 97 504 505LATIN CAPITAL LETTER U WITH GRAVE: Ù => f4 506ô => 99 507 508LATIN SMALL LETTER DOTLESS I: ı => f5 509õ => 9b 510 511MODIFIER LETTER CIRCUMFLEX ACCENT: ˆ => f6 512ö => 9a 513 514SMALL TILDE: ˜ => f7 515÷ => d6 516 517MACRON: ¯ => f8 518ø => bf 519 520BREVE: ˘ => f9 521ù => 9d 522 523DOT ABOVE: ˙ => fa 524ú => 9c 525 526RING ABOVE: ˚ => fb 527û => 9e 528 529CEDILLA: ¸ => fc 530ü => 9f 531 532DOUBLE ACUTE ACCENT: ˝ => fd 533ý => ý 534 535OGONEK: ˛ => fe 536þ => þ 537 538CARON: ˇ => ff 539ÿ => d8 540