我的数据库、页面用的是GB2312编码
在TP的配置文件里设置的也是GB2312使用TP自带的分页类,输出后事UTF-8 导致乱码
求解决办法
谢谢

解决方案 »

  1.   

    $str = iconv("UTF-8", "GB2312", $str);
      

  2.   

    转呗
    iconv('utf-8','gb2312',$str);
      

  3.   

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
    <html>
    <head></head>
    <body>
    <table border="1">
      <tr>
      <th width="10%">ID</th>
      <th width="30%">中国</th>
      <th width="30%">password</th>
      
      </tr>
      <volist name="list" id="vo">
      <tr>
      <td align="center">{$vo['id']}</td>
      <td>{$vo['name']}</td>
      <td>{$vo['pass']}</td>
      </tr>
      </volist>
    </table>
    </body>
    </html>
    页面为UTF8时,以上代码在输出后“中国”显示为乱码,数据库中文数据显示正常。而页面为GB2312时,
    以上代码在输出后“中国”显示为正常,数据库中文数据显示乱码。请问这是为什么?