PHP加文字水印时报错 imagettftext() [function.imagettftext]: any2eucjp()

解决办法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 problem
about JIS is when you pass a non UTF-8 string, it can be seen as JIS
enconded string.

About the mbstring issues, I have no idea how it works and how it
affects the input parameters. It is something happening before we got
the 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;
}
?>

 

 

参考:

http://hi.baidu.com/xuguangzhi2003/item/9dd321e68460b8afc00d753b

http://blog.sina.com.cn/s/blog_6d677b680100tqb3.html

http://stackoverflow.com/questions/910793/detect-encoding-and-make-everything-utf-8

 

转载于:https://www.cnblogs.com/hubo2/archive/2012/09/03/2669447.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值