unicode_escape_surrogates.phpt 417 B

12345678910111213141516
  1. --TEST--
  2. Valid Unicode escape sequences: Surrogate halves
  3. --FILE--
  4. <?php
  5. // Surrogate pairs are non-well-formed UTF-8 - however, it is sometimes useful
  6. // to be able to produce these (e.g. CESU-8 handling)
  7. var_dump(bin2hex("\u{D801}"));
  8. var_dump(bin2hex("\u{DC00}"));
  9. var_dump(bin2hex("\u{D801}\u{DC00}")); // CESU-8 encoding of U+10400
  10. ?>
  11. --EXPECT--
  12. string(6) "eda081"
  13. string(6) "edb080"
  14. string(12) "eda081edb080"