解决JPGraph的中文乱码问题2011-09-25JPGraph处理有中文字符时都会转成utf8编码后显示,我们只需注释掉相关的代码就可以了。Dotproject苷特图中文乱码解决具体步骤如下:1。修改jpgraph库打开dotproject libjpgraphjpgraphsrcjpgraph.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模块打开dotprojectmodulesprojectsgantt.php文件,修改文件中下面的代码将所有arialbd.ttf用simsum.ttc替换将所有FF_ARIAL用FF_SIMSUN替换注释掉下面的代码//if ( $locale_char_set=="utf-8" && function_exists("utf8_decode") ) {//$name = utf8_decode($name);//}b.同理修改dotprojectmodules asksgantt.php文件