1--TEST--
2Test mb_strtoupper() function : usage varitations - pass mixed ASCII and non-ASCII strings
3--EXTENSIONS--
4mbstring
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
12echo "*** Testing mb_strtoupper() : usage variations ***\n";
13
14$string_mixed_upper = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
15$string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==');
16$string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC');
17
18
19echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
20$a = mb_strtoupper($string_mixed_lower, 'UTF-8');
21var_dump(base64_encode($a));
22if ($a == $string_mixed_upper) {
23    echo "Correctly Converted\n";
24} else {
25    echo "Incorrectly Converted\n";
26}
27
28echo "\n-- Multibyte Only String--\n";
29$b = mb_strtoupper($string_all_mb, 'UTF-8');
30var_dump(base64_encode($b));
31if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
32    echo "Correctly Converted\n";
33} else {
34    echo "Incorrectly Converted\n";
35}
36
37echo "Done";
38?>
39--EXPECT--
40*** Testing mb_strtoupper() : usage variations ***
41
42-- Mixed string (mulitbyte and ASCII characters) --
43string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=="
44Correctly Converted
45
46-- Multibyte Only String--
47string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC"
48Correctly Converted
49Done
50