Testlink与Mantis集成后,乱码解决办法

安装好TestLink 和Mantis后,所有配置好以后,发现测试相关的BUG标题中文是乱码,网上找了若干文章没有解决,自己摸索出一下方法。

Mantis版本: 1.1.0(RC2)
TestLink版本:1.7.1
PHP版本:5.2.5
MySQL版本:5.0.22

需要修改TestLink的文件:lib\bugtracking\int_mantis.php

 function getBugSummaryString($id)
 {
  if (!$this->isConnected())
   return false;
  
  //$this->m_dbConnection->aaa();
  $this->m_dbConnection->exec_query("set names 'GB2312'");  //<-新增加的
  
  $status = null;
  // 20070302 - {$this->m_dbName}.mantis_bug_table -> mantis_bug_table
  // Problems with MS-SQL
  $query = "Select summary FROM mantis_bug_table Where id='" . $id."'";
  
  $result = $this->m_dbConnection->exec_query($query);
  if ($result)
  {
   $summary = $this->m_dbConnection->fetch_array($result);

   // 20070302 - BUGID - on MS-SQL fetch_array() does not returns numeric indexes, then
   //                    only choice is accessing my field name (IMHO better)
   if ($summary)
    $summary = iconv("GB2312",TL_TPL_CHARSET,$summary['summary']);//<-修改的
   else
    $summary = null;
  }
  return $summary;
 }



源文出自:http://www.joyblog.cn/article.asp?id=463

你可能感兴趣的:(Testlink与Mantis集成后,乱码解决办法)