mantis统计报表和图形报表出现乱码问题的解决方法
Mantis 报表中文乱码
1、安装Mantis图表 1.0插件
administrator登录-------管理------插件管理,安装插件
2、上传字体simhei.ttf simsun.ttc simsun.ttf 三个文件(可网上下载)到/usr/share/fonts/truetype/
3、下载jpGraph (下载地址)
# tar zxvf jpgraph-3.5.0b1.tar.gz
# cp src/ /usr/local/nginx/html/mantisbt/library/jpgraph/ 复制src并重命名为jpgraph ,/usr/local/nginx/html/mantisbt/为网站目录
4、修改配置文件
# cd /usr/local/nginx/html/mantisbt/library/jpgraph
# vim jpgraph_ttf.inc.php
183 elseif( $aFF === FF_SIMSUN ) { 大概183行
184 // Do Chinese conversion
185 # if( $this->g2312 == null ) { 注释
186 # include_once 'jpgraph_gb2312.php' ; 注释
187 # $this->g2312 = new GB2312toUTF8(); 注释
188 # } 注释
189 # return $this->g2312->gb2utf8($aTxt); 注释
190 return $aTxt; 添加
191 }
# cd ../../plugins/MantisGraph/core/
# vim graph_api.php
56 if ( plugin_config_get( 'eczlibrary' ) == ON ) {
57 $t_font_map = array(
58 'simsun' => 'SIMFANG.TTF', 添加这行
59 'arial' => 'arial.ttf',
60 'verdana' => 'verdana.ttf',
61 'trebuchet' => 'trebuc.ttf',
62 'verasans' => 'Vera.ttf',
63 'times' => 'times.ttf',
64 'georgia' => 'georgia.ttf',
65 'veraserif' => 'VeraSe.ttf',
66 'courier' => 'cour.ttf',
67 'veramono' => 'VeraMono.ttf',
68 );
85 $t_font_map = array(
86 'simsun' => FF_SIMSUN, 添加此行
87 'arial' => FF_ARIAL,
88 'verdana' => FF_VERDANA,
89 'trebuchet' => FF_TREBUCHE,
90 'verasans' => FF_VERA,
91 'times' => FF_TIMES,
92 'georgia' => FF_GEORGIA,
93 'veraserif' => FF_VERASERIF,
94 'courier' => FF_COURIER,
95 'veramono' => FF_VERAMONO,
96 );
# cd ../pages/
# vim config.php
24 $t_current_font_selected = array(
25 'simsun' => false, 添加这行
26 'arial' => false,
27 'verdana' => false,
28 'trebuchet' => false,
29 'verasans' => false,
30 'times' => false,
31 'georgia' => false,
32 'veraserif' => false,
33 'courier' => false,
34 'veramono' => false,
35 );
121 Sans-serif:<br />
122 <label><input
type="radio" name="font" value="simsun"<?php echo print_font_checked(
'simsun ' )?>/>simsun</label><br /> 添加这行
123 <label><input type="radio" name="font"
value="arial"<?php echo print_font_checked( 'arial'
)?>/>Arial</label><br />
124 <label><input type="radio" name="font"
value="verdana"<?php echo print_font_checked( 'verda na'
)?>/>Verdana</label><br />
125 <label><input type="radio" name="font"
value="trebuchet"<?php echo print_font_checked( 'tre buchet'
)?>/>Trebuchet</label><br />
126 <label><input type="radio" name="font"
value="verasans"<?php echo print_font_checked( 'vera sans'
)?>/>Vera Sans</label>
127 </td>
# vim config_edit.php
47 if ( plugin_config_get( 'font' ) != $f_font ) {
48 switch ( $f_font ) {
49 case 'simsun': 添加这行
50 case 'arial':
51 case 'verdana':
52 case 'trebuchet':
53 case 'verasans':
54 case 'times':
55 case 'georgia':
56 case 'veraserif':
57 case 'courier':
58 case 'veramono':
59 plugin_config_set( 'font', $f_font );
60 break;
61 default:
5、设置报表字体为宋体
administrator登录-----------管理------------插件管理--------- Mantis图表 1.0
6、刷新报表,可以看到显示中文正常