十五年测试老手,长期负责WEB\APP 项目测试,目前主要负责团队管理工作。

JPGraph中文乱码问题

上一篇 / 下一篇  2008-11-27 10:41:57 / 个人分类:配置

 

(~OT0MfS0jpgraph处理有中文字符时都会转成utf8编码后显示,我们只需注释掉相关的代码就可以了。51Testing软件测试网3E*Vf t&u;l

W!A:q1EvRpo0dotproject苷特图中文乱码解决具体步骤如下:

(b CXXv051Testing软件测试网 gr@2]G X-[$?(X B

1。修改jpgraph库51Testing软件测试网U'n6iG'g2oE%^Q

51Testing软件测试网a#pZ9f4@ ue

打开dotproject \lib\jpgraph\jpgraph\src\jpgraph.php文件,找到下面代码段

;F$Y _'p H6mf0O}051Testing软件测试网X4Z~A,o+U NV

    function convert($atxt,$aff) {51Testing软件测试网4p6P1S)bYw#@
 if( language_cyrillic ) {
(CwG"zA&I6~l0     if( cyrillic_from_windows ) {51Testing软件测试网/H!E7U#{B6F4Z
  $atxt = convert_cyr_string($atxt, "w", "k");51Testing软件测试网|K(PE_b
     }
L{wHqQ0     $isostring = convert_cyr_string($atxt, "k", "i");51Testing软件测试网@q3sA%I{ x
     $unistring = languageconv::iso2uni($isostring);
2g`D9JB'bP0     return $unistring;51Testing软件测试网(k^.Ju]
 }/* 注释掉下面代码段51Testing软件测试网Z E}{:\&fp
 elseif( $aff === ff_simsun ) {51Testing软件测试网-c6cheM)oA1]5a
     // do chinese conversion51Testing软件测试网1{M `CQ`k"zf2S
     if( $this->g2312 == null ) {51Testing软件测试网EAM\nR;H-K
  include_once 'jpgraph_gb2312.php' ;51Testing软件测试网x/HQ3q#G"s"~Y
  $this->g2312 = new gb2312toutf8();
*m7q&ve2XN0     }51Testing软件测试网{/g,e&k`j#B
     return $this->g2312->gb2utf8($atxt);51Testing软件测试网:V1l!G1];`y
 }51Testing软件测试网2nI-iK2z*[
 elseif( $aff === ff_chinese ) {51Testing软件测试网#AH.?8N.N)X
     if( !function_exists('iconv') ) {
Y0f3Om3n!r0  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).');
PGt'jh)M1Yu0     }51Testing软件测试网j Z'?Lh+[J$@
     return iconv('big5','utf-8',$atxt);
#a9Q}BT&e @5\0 }注释到此结束*/51Testing软件测试网)t8P*UTy$K
 else51Testing软件测试网 b'LYOFo4c2f
     return $atxt;
fV V9L y:g.n"J0    }

^&}!}k`8L"L051Testing软件测试网v*A IR3sq

2.修改dotproject中用到jpgraph的模块51Testing软件测试网2Sh B [1A-]k

51Testing软件测试网~5T%tV_n$_bd:y

  a.  改project模块51Testing软件测试网tyI/~^.u

IJF&cu/t+Q v}0打开dotproject\modules\projects\gantt.php文件,修改文件中下面的代码51Testing软件测试网vU+c-f+p

fT[Ji@9J0将所有51Testing软件测试网 Z:cDBd3V A

;fB R(|*jwj0arialbd.ttf51Testing软件测试网i"[J$sH!?\+Dd

51Testing软件测试网r doPP[

51Testing软件测试网1S;YT#~7@*f

51Testing软件测试网 vI3c[e\,@h'er

simsum.ttc51Testing软件测试网J+t&?B9jVO0c

m?V'_4x~P0替换51Testing软件测试网#Ig_.{"e/K a8i

*z6^*]FI3ipz0将所有

%z,W6SH h8K/m0W!D Qr051Testing软件测试网8z9t|.?8_YP)rBI

ff_arial

b-|] A)td7p9{0

\1jki9g9A051Testing软件测试网d^fyP\

51Testing软件测试网i Lm IN&v]

ff_simsun51Testing软件测试网2h9nXX{o|

51Testing软件测试网D'?X]0}_rV

替换

0KT"q4b)WJu0

K zo%n-n0注释掉下面的代码51Testing软件测试网4V d HyV[

/X,Z8ZlMf2D.w0 //if ( $locale_char_set=='utf-8' && function_exists("utf8_decode") ) {51Testing软件测试网m rFX6fR#G;`q:MP
 // $name = utf8_decode($name);
0Yk,^,H3I/B;X#p9d0 //}51Testing软件测试网Fm HLtH

51Testing软件测试网&Q[K g*}w

b.同理修改dotproject\modules\tasks\gantt.php文件51Testing软件测试网K t @ k5o*XO h

51Testing软件测试网k/e;t.oG3ml+n

文章出处:http://www.diybl.com/course/1_web/webjs/2007113/82750.html

cK9Ouv q\ ]K8k0

TAG: JPGraph 乱码 配置

 

评分:0

我来说两句

Open Toolbar