mysql connection related to EUR € symbol using PHP

"€" can not be recognized by ISO-8859-1 standard as it is encoded by UTF-8.
By default, mysql connection using ISO-8859-1 based connection, and will turn "€" as "â" using mysql query.   In order to get a correct "€", then mysql connection should be like this:

$conn = mysql_connect($host.':'.$port, $username, $password);
mysql_set_charset("utf8");
$query = "select ...";
$db= mysql_select_db($database, $conn);
$result = mysql_query($query);

Comments

Popular posts from this blog

install ipython in Cloudera VM using pip

install postgreSQL in ubuntu 16.04

Install MYSQL 5.6 in ubuntu 12.04/14.04 and set password and remote access