4lisalehi
4lisalehi

Reputation: 29

DB table rows including Persian characters not showing properly on the web page

I've connected my php webpage to my .mdb database via odbc connection.

My first question is:

What should I do to avoid ???? instead of proper Persian characters, when displaying my db table rows on the page.

My sample html code:

<form action="" method="post">
    <input type="text" value="my_value">
</form>

My sample PHP code:

<?php

$conn = odbc_connect('my_db','','');
if (!$conn) {
    exit("Connection Failed: " . $conn);
}

$submitted_value = $_POST["my_value"];
$sql = "SELECT * FROM my_table WHERE column1 = '$submitted_value'";
$result = odbc_exec($conn,$sql);
odbc_close($conn);

?>

My charset is already set to UTF-8 in php.ini.

And my second question is: (which I think might be because of the above problem):

When I type Persian in the html input value tag (instead of "my_value") and already have a row with exactly the same value in column 1, nothing is returned.

But When I change both value tag name and column 1 value of the table row to English. The result is returned.

Can anyone help me with this? I appreciate in advance.

Upvotes: 0

Views: 298

Answers (1)

Clown Man
Clown Man

Reputation: 393

Check to make sure your database is also configured to store UTF8, some only do ASCII. Also, when displaying, make sure the HTML document is configured to display UTF8.

Example:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-6">

source: http://www.webdeveloper.com/forum/showthread.php?224111-Can-t-see-my-persian-arabic-text-in-HTML-editor

Upvotes: 1

Related Questions