User97798 User97798 - 4 months ago 9
MySQL Question

Unable to fetch characters as in Mysql database

Unable to fetch characters as in MySql database below is the table.

Table1
+-------------------------------+
| APH | ID0 |
+-------------------------------+
| A | Costa Rican Colón |
| B | Icelandic Króna |
| C | Somali Shilling |
| D | Nicaraguan Córdoba |
+-------------------------------+


when i get the from db by using PDO in php
then the above character shown like this

Costa Rican Col�n

what should i do?

Answer

After fetching from mysql you need to use htmlentities like below in PHP

$str = htmlentities('Costa Rican Colón');
echo $str;exit;