I have a mysql database table to store the country name and currency symbol - CHARSET installed UTF8 correctly.
This is an example of data inserted into a 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 seems fine, but when I extract it from the database and display it on the website, a strange square symbol appears with a question mark inside instead of the pound symbol.
Edit In my.cnf - the character set 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
Sort Options
- 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 advise thanks