0

There's been a lot of help on the web about displaying Hindi text in PHP/HTML from a database, but none of it worked for me.

I have the data stored in MS Access [SAP.mdb], and I want that the data [already in Hindi in the db] to be displayed in Hindi in PHP.

The code that I have tried is given below. I have been applied every possible solution but all I got was ????????

<! 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>
dda
  • 6,030
  • 2
  • 25
  • 34
mastero
  • 21
  • 1
  • 1
  • 4

1 Answers1

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.

Danack
  • 24,939
  • 16
  • 90
  • 122