解决办法1:
由于GD库编译时添加了: --enable-gd-jis-conv 的支持( GD: Enable JIS-mapped Japanese font ) , 在phpinfo()里也可以看到:JIS-mapped Japanese Font Support的支持为enable,需要重新编译PHP,在编译PHP时,去掉 --enable-gd-jis-conv即可
去掉编译选项“--enable-gd-jis-conv”
关闭GD库中 “JIS-mapped Japanese Font Support”
贴上官方的解释:There is no fallback ot UTF-8. It accepts UTF-8 by default. The problemabout JIS is when you pass a non UTF-8 string, it can be seen as JISenconded string.About the mbstring issues, I have no idea how it works and how itaffects the input parameters. It is something happening before we gotthe hand in the gd function.
解决办法2:
mb_convert_encoding($markWords,"html-entities","UTF-8")
/*** 将文本由UTF8编码转化为数字形式编码(HTML实体)* @param $arr 该参数可以为数组或者string* @author Steven lxq70361@qq.com*/ function iconv_arr($arr){ if(is_array($arr)){ foreach($arr as $k=>$v){ $arr[$k] = iconv_arr($v); } }else{ $arr = mb_convert_encoding($arr, "html-entities","utf-8" );}return $arr;}?>
参考: