1--TEST-- 2Test mb_substitute_character() function : variation unmappable out char for convert encoding 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_substitute_character') or die("skip mb_substitute_character() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* Prototype : mixed mb_substitute_character([mixed substchar]) 11 * Description: Sets the current substitute_character or returns the current substitute_character 12 * Source code: ext/mbstring/mbstring.c 13 * Alias to functions: 14 */ 15 16echo "*** Testing mb_substitute_character() : variation ***\n"; 17//japenese utf-8 18$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI'); 19 20//output the default which is ? in ISO-8859-1, x3f 21var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 22 23mb_substitute_character(66); //'B' in ISO-8859-1, x42 24var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 25mb_substitute_character("none"); //no substitution 26var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 27mb_substitute_character(280); //not valid in ISO-8859-1 28var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 29 30 31?> 32===DONE=== 33--EXPECT-- 34*** Testing mb_substitute_character() : variation *** 35string(14) "3f3f3f3f3f3f3f" 36string(14) "42424242424242" 37string(0) "" 38string(0) "" 39===DONE=== 40