JPGraph处理有中文字符时都会转成utf8编码后显示,我们只需注释掉相关的代码就可以了。
Dotproject苷特图中文乱码解决具体步骤如下:
1。修改jpgraph库
打开dotproject \lib\jpgraph\jpgraph\src\jpgraph.php文件,找到下面代码段
function Convert($aTxt,$aFF) {
if( LANGUAGE_CYRILLIC ) {
if( CYRILLIC_FROM_WINDOWS ) {
$aTxt = convert_cyr_string($aTxt, "w", "k");
}
$isostring = convert_cyr_string($aTxt, "k", "i");
$unistring = LanguageConv::iso2uni($isostring);
return $unistring;
}/* 注释掉下面代码段
elseif( $aFF === FF_SIMSUN ) {
// Do Chinese conversion
if( $this->g2312 == null ) {
include_once 'jpgraph_gb2312.php' ;
$this->g2312 = new GB2312toUTF8();
}
return $this->g2312->gb2utf8($aTxt);
}
elseif( $aFF === FF_CHINESE ) {
if( !function_exists('iconv') ) {
JpGraphError::Raise('Usage of FF_CHINESE (FF_BIG5) font family requires that your PHP setup has the iconv() function. By default this is not compiled into PHP (needs the "--width-iconv" when configured).');
}
return iconv('BIG5','UTF-8',$aTxt);
}注释到此结束*/
else
return $aTxt;
}
2.修改dotproject中用到jpgraph的模块
a. 改project模块
打开dotproject\modules\projects\gantt.php文件,修改文件中下面的代码
将所有
arialbd.ttf
用
simsum.ttc
替换
将所有
FF_ARIAL
用
FF_SIMSUN
替换
注释掉下面的代码
//if ( $locale_char_set=='utf-8' && function_exists("utf8_decode") ) {
// $name = utf8_decode($name);
//}
b.同理修改dotproject\modules\tasks\gantt.php文件