Reputation: 3857
I am pulling through the field item_name from a database. It should read : "Reminisce Basic £11.99 + Card £4.99 + Free"
But when its coming through the £ signs are coming out as � is there a method to decode this to at least make it look like a £ sign?
My code is as follows :
<?php
$con = mysql_connect("localhost","","");
mysql_select_db("", $con);
$result = mysql_query("SELECT custom, item_name from paypalsub WHERE custom = '$_SESSION[uid]'");
while($row = mysql_fetch_array($result))
{
$sub_type = $row['item_name'];
}
?>
<h2>You are currently subscribed to : <?php echo ($sub_type); ?></h2>
The H2 is outputting it like this :
You are currently subscribed to : Reminisce Basic �11.99 + Card �4.99 + Free
Any help.. Much appreciated.
Upvotes: 1
Views: 995
Reputation: 35008
It looks like your database is in some encoding (not UTF-8) and your output is in a different encoding.
Find out which encoding the database uses.
Upvotes: 0
Reputation: 29424
header('content-type: text/html; charset=utf-8')
mysql_query("SET NAMES 'utf-8'");
Upvotes: 1
Reputation: 3351
Try with utf8_encode($string) or utf8_decode($string). I never remember which one to use, sorry.
Upvotes: 1