百度空间 | 百度首页 
 
查看文章
 
JPGraph中文乱码问题
2009年02月17日 星期二 22:16

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文件


类别:Php | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu