关于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下显示:
还望各位兄弟姐妹看看,小弟先谢过了!
回复内容:
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下显示:
还望各位兄弟姐妹看看,小弟先谢过了!
%e6%88%91
是urlencode('我')
的结果,是不是通过URL进行参数传递没有解码的问题。
我很奇怪windows上是白色的,怎么Linux下就黄了。。
图片水印出现乱码,一般是两个问题。
文本编码是否统一为utf8
GD库是否启用JIS-mapped Japanese Font Support
编码不统一,那就统一一下,启用JIS-mapped Japanese Font Support了,就关闭即可。
什么?你说JIS-mapped Japanese Font Support怎么关闭?
我的方法是重新编译php-gd拓展。
确认过了
文件编码是一致的;
编译参数没有加 --enable-gd-jis-conv的;
windows下测试正常就直接上传到linux服务器了。。。
推荐阅读
-
完美解决关于禁止ViewPager预加载的相关问题
-
Mysql彻底解决中文乱码问题的方案(Illegal mix of collations for operation)
-
Android 解决WebView调用loadData()方法显示乱码的问题
-
python 采集中文乱码问题的完美解决方法
-
关于mysql delete的问题小结
-
Android 处理OnItemClickListener时关于焦点颜色的设置问题
-
完美转换MySQL的字符集 解决查看utf8源文件中的乱码问题
-
PHP使用PDO操作数据库的乱码问题解决方法
-
解决表单post,get到springMVC后台乱码的问题
-
Mysql 下中文乱码的问题解决方法总结