首页 > 关于imagettftext乱码的问题

关于imagettftext乱码的问题

imagettftext函数在windows下中文显示正常,在linux下中文就出现了乱码。。。
核心代码如下:

//此处省略N行。。。
$image = imagecreatetruecolor($width, $height);
$color = imagecolorallocate($image, $red, $green, $blue);
imagefill($image, 0, 0, $color);
$tcolor = imagecolorallocate($image, $tred, $tgreen, $tblue);
//imagestring ($image,  $fontfile,  20 ,  20 ,  "Hello world!" ,  $tcolor);
//echo floor(($height - $fontinfo['height']) / 2);die;
imagettftext($image, $tsize, 0, ($width - $fontinfo['width']) / 2, $height / 2, $tcolor, $fontfile, $text);
//此处省略N行。。。

转码什么的都试过了,不行!也觉得不是编码的问题。。。
linux下也已经安装了msyh.ttf字体。。。

windows下显示:

linux下显示:

还望各位兄弟姐妹看看,小弟先谢过了!


图片水印出现乱码,一般是两个问题。

编码不统一,那就统一一下,启用JIS-mapped Japanese Font Support了,就关闭即可。

什么?你说JIS-mapped Japanese Font Support怎么关闭?

我的方法是重新编译php-gd拓展。


确认过了
文件编码是一致的;
编译参数没有加 --enable-gd-jis-conv的;
windows下测试正常就直接上传到linux服务器了。。。


%e6%88%91urlencode('我')的结果,是不是通过URL进行参数传递没有解码的问题。
我很奇怪windows上是白色的,怎么Linux下就黄了。。

【热门文章】
【热门文章】