Skip to Main Content

Displaying characters on the Web

AmineDzJul 11 2011 — edited Jul 11 2011
Hi All,

I have this script that brings data from a DB.

<?php

$conn = oci_connect('my_user', 'my_pwd', 'my_db');

$stid = oci_parse($conn, 'select arabic_name from emp where id = 1');
oci_execute($stid);

echo "<table>\n";
while (($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>".($item !== null ? htmlentities($item, ENT_QUOTES) : "&nbsp;")."</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";

echo "ãÍãÏ Ããíä";

?>

The output is :

<table>
<tr>
<td>&atilde;&Iacute;&atilde;&Iuml; &Atilde;&atilde;&iacute;&auml;</td>
</tr>
</table>

ãÍãÏ Ããíä

The problem is that "ãÍãÏ Ããíä" is completly equivalent to "&atilde;&Iacute;&atilde;&Iuml; &Atilde;&atilde;&iacute;&auml;".

It seems like PHP is interpreting the data from my_db.

How can I redirect PHP behavior so it brings "ã" rather then "&atilde;" and "Í" rather then "&Iacute;", ...

So my desired out put is :
<table>
<tr>
<td>ãÍãÏ Ããíä</td>
</tr>
</table>

ãÍãÏ Ããíä

Thank you in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Aug 8 2011
Added on Jul 11 2011
1 comment
135 views