1--TEST-- 2Test mb_strtoupper() function : usage varitations - pass mixed ASCII and non-ASCII strings 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* Prototype : string mb_strtoupper(string $sourcestring [, string $encoding] 11 * Description: Returns a uppercased version of $sourcestring 12 * Source code: ext/mbstring/mbstring.c 13 */ 14 15/* 16 * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower 17 * to check correct conversion is occurring (Japanese characters should not be converted). 18 */ 19 20echo "*** Testing mb_strtoupper() : usage variations ***\n"; 21 22$string_mixed_upper = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=='); 23$string_mixed_lower = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCcGhwLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg=='); 24$string_all_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC'); 25 26 27echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n"; 28$a = mb_strtoupper($string_mixed_lower, 'UTF-8'); 29var_dump(base64_encode($a)); 30if ($a == $string_mixed_upper) { 31 echo "Correctly Converted\n"; 32} else { 33 echo "Incorrectly Converted\n"; 34} 35 36echo "\n-- Multibyte Only String--\n"; 37$b = mb_strtoupper($string_all_mb, 'UTF-8'); 38var_dump(base64_encode($b)); 39if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion 40 echo "Correctly Converted\n"; 41} else { 42 echo "Incorrectly Converted\n"; 43} 44 45echo "Done"; 46?> 47--EXPECT-- 48*** Testing mb_strtoupper() : usage variations *** 49 50-- Mixed string (mulitbyte and ASCII characters) -- 51string(80) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCUEhQLiAwMTIzNO+8le+8lu+8l++8mO+8meOAgg==" 52Correctly Converted 53 54-- Multibyte Only String-- 55string(40) "5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CC" 56Correctly Converted 57Done 58