unicode.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Test V8::executeString() : Check if imported code works with umlauts
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. # maybe more characters (e.g. from http://www.ltg.ed.ac.uk/~richard/unicode-sample.html?)
  8. $unicode = 'äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃';
  9. # insert unicode via snapshot
  10. $snapshot = V8Js::createSnapshot("var snapshot = {unicode: '" . $unicode . "'}");
  11. # start V8Js
  12. $jscript = new V8Js('php', array(), array(), true, $snapshot);
  13. # insert unicode via php var
  14. $jscript->unicode = $unicode;
  15. # insert unicode via executeString
  16. $jscript->executeString("var execStr = {unicode: '" . $unicode . "'}");
  17. # return to php
  18. $jscript->executeString("values = {}");
  19. $jscript->executeString("values['snapshot'] = snapshot.unicode");
  20. $jscript->executeString("values['php'] = php.unicode");
  21. $jscript->executeString("values['execStr'] = execStr.unicode");
  22. $values = $jscript->executeString("values");
  23. echo "snapshot: $values->snapshot\n";
  24. echo "php : $values->php\n";
  25. echo "execStr : $values->execStr\n";
  26. ?>
  27. ===EOF===
  28. --EXPECT--
  29. snapshot: äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃
  30. php : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃
  31. execStr : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃
  32. ===EOF===