Home > Backend Development > PHP Tutorial > php通过odbc读取informix数据出现乱码,应该怎么修改?

php通过odbc读取informix数据出现乱码,应该怎么修改?

WBOY
Release: 2016-06-02 11:34:57
Original
1890 people have browsed it

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>
Copy after login
<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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template