mb_strtoupper_variation3.phpt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test mb_strtoupper() function : usage varitations - pass mixed ASCII and non-ASCII strings
  3. --EXTENSIONS--
  4. mbstring
  5. --FILE--
  6. <?php
  7. /*
  8. * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
  9. * to check correct conversion is occurring (Japanese characters should not be converted).
  10. */
  11. echo "*** Testing mb_strtoupper() : usage variations ***\n";
  12. $string_mixed_upper = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
  13. $string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
  14. $string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
  15. echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
  16. $a = mb_strtoupper($string_mixed_lower, 'UTF-8');
  17. var_dump(base64_encode($a));
  18. if ($a == $string_mixed_upper) {
  19. echo "Correctly Converted\n";
  20. } else {
  21. echo "Incorrectly Converted\n";
  22. }
  23. echo "\n-- Multibyte Only String--\n";
  24. $b = mb_strtoupper($string_all_mb, 'UTF-8');
  25. var_dump(base64_encode($b));
  26. if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
  27. echo "Correctly Converted\n";
  28. } else {
  29. echo "Incorrectly Converted\n";
  30. }
  31. echo "Done";
  32. ?>
  33. --EXPECT--
  34. *** Testing mb_strtoupper() : usage variations ***
  35. -- Mixed string (mulitbyte and ASCII characters) --
  36. string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=="
  37. Correctly Converted
  38. -- Multibyte Only String--
  39. string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
  40. Correctly Converted
  41. Done