Maison > Article > développement back-end > php通过odbc读取informix数据出现乱码,应该怎么修改?
phpodbc乱码informix
是修改client locale和database locale还是修改其他?修改成什么?
我是用php调用的,可以通过php语言转换所调用数据编码吗?
网页显示结果如下:
<code>今天日期:12-12-04险种 单数 保费���� 994 1974911.90������ 20 68230.00������ 10 3750.00������ 52 8026.43�Ҳ��� 24 15090.00�ϼ� 1100 2070008.33</code>
<code> <title>PHP and ODBC 1</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <?php $conn=odbc_connect('sky123','picctj','picctj'); if (($conn)) { echo "今天日期:";echo date("y-m-d"); echo odbc_errormsg ($conn ); echo "</p>\n"; } $sql = "SELECT * from tongji"; $rs = odbc_exec($conn,$sql); echo "<table>"; echo "<tr> <td>险种</td> <td>单数</td> <td>保费</td> </tr>"; while (odbc_fetch_row($rs)) { $result1 = odbc_result($rs,"xianzhong"); $result2 = odbc_result($rs,"danshu"); $result3 = odbc_result($rs,"baofei"); iconv("Latin-1","gb2312",$result1);//测试的代码 echo "<tr>"; echo "<td>$result1</td>"; echo "<td>$result2</td>"; echo "<td>$result3</td>"; echo "</tr>"; } odbc_close($conn); echo "</table>"; ?> </code>