1--TEST-- 2Test mb_substitute_character() function : variation unmappable out char for convert encoding 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6?> 7--FILE-- 8<?php 9echo "*** Testing mb_substitute_character() : variation ***\n"; 10//japenese utf-8 11$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI'); 12 13//output the default which is ? in ISO-8859-1, x3f 14var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 15 16mb_substitute_character(66); //'B' in ISO-8859-1, x42 17var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 18mb_substitute_character("none"); //no substitution 19var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 20mb_substitute_character(280); //not valid in ISO-8859-1 21var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8"))); 22 23 24?> 25--EXPECT-- 26*** Testing mb_substitute_character() : variation *** 27string(14) "3f3f3f3f3f3f3f" 28string(14) "42424242424242" 29string(0) "" 30string(14) "3f3f3f3f3f3f3f" 31