0

网上有很多关于从数据库中以 PHP/HTML 显示印地语文本的帮助,但没有一个对我有用。

我将数据存储在 MS Access [SAP.mdb] 中,我希望数据 [已经在 db 中的印地语中] 以 PHP 中的印地语显示。

我尝试过的代码如下所示。我已经应用了所有可能的解决方案,但我得到的只是 ?????????

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <body>
  <meta http-equiv="Content-Language" content="hi">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <label>
    <form id="form1" name="form1" method="get" action="trial10.php">
      SAP ID<input type="text" name="textfield" default="ff"/>
      <?php
        header( 'Content-Type: text/html; charset=utf-8' );
        $conn = odbc_connect("manish", "","");
        echo $conn;
        $sql="SELECT * FROM SAP";
        $rs=odbc_exec($conn,$sql);
        echo $rs;
        odbc_fetch_row($rs);
        echo odbc_result($rs,3);
      ?>
    </label>
  </body>
</html>
4

1 回答 1

0

You will have either an error in how your retrieving the data from the database or how you're sending it to the browser.

To find out which please put this code where you are echo'ing the data:

$result = odbc_result($rs,3);
$resultInHex = unpack('H*', $result);
$resultInHex = $resultInHex[1];
$resultSeparated = implode(', ', str_split($resultInHex, 2)); //byte safe

var_dump($resultSeparated);

That will split the bytes retrieved from the database and show their raw value. i.e. you will be able to see if the correct bytes have been retrieved, or whether the error occurs between PHP and the database.

于 2013-06-09T17:10:57.150 回答