Hello I have a mysql database table to store country name and currency symbol - the CHARSET has correctly set to UTF8.
This is example data inserted into the table
insert into country ( country_name, currency_name, currency_code, currency_symbol) values ('UK','Pounds','GBP','£');
When I look in the database - the pound symbol appears fine - but when I retrieve it from the database and display it on the website - a weird square symbol shows up with a question mark inside instead of the pound symbol.
Edit In my.cnf - the characterset was set to latin1 - I changed it to utf8 - then I Logged in as root and ran \s - it returned
Server characterset: utf8 Client characterset: utf8
Collations
-- Database SELECT default_collation_name FROM information_schema.schemata WHERE schema_name = 'swipe_prod'; THIS DOES NOT RETURN ANYTHING -- Table SELECT table_collation FROM information_schema.tables WHERE TABLE_NAME = 'country'; THIS RETURNS utf8_general_ci -- Columns SELECT collation_name FROM information_schema.columns WHERE TABLE_NAME = 'country'; THIS RETURNS 7 ROWS but all have either null or utf8_general_ci
PHP CODE
<?php $con = mysql_connect("localhost","user","123456"); mysql_select_db("swipe_db", $con); $result = mysql_query("SELECT * FROM country where country_name='UK'"); while($row = mysql_fetch_array($result)) { echo $row['country_name'] . " " . $row['currency_symbol']; } mysql_close($con); ?>
Please advice Thanks