Euro sign does not appear on the site

One of my fields (which is latin1_swedish_ci) seems to show the euro symbol in PHPMYADMIN inside the field.

However, when I try to repeat it in the input box on my website in the form, it appears as a question mark in firefox.

Here is the html / php:

$sql = mysql_query("select * from `settings`"); while ($row = mysql_fetch_assoc($sql)) $setting[$row['field']] = htmlspecialchars($row['value'], ENT_QUOTES); <input type="text" name="currency_symbol" id="currency_symbol" size="50" value="<?php echo $setting['currency_symbol']; ?>" /> 

I use the following meta tag on the page:

 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 

I tried using utf8_general_ci for the field, but I get the same result.

+7
source share
3 answers

Try using htmlentities() instead of htmlspecialchars() .

Special characters do not convert everything, just a few characters. Euro symbol €, must be truly encoded, &euro; .

+6
source

If you serve the page as UTF-8, you need to make sure that you retrieved the row from the database in UTF-8 encoding before putting it on the page. You can do this using:

 mysql_set_charset('utf8'); 

(If you do this, it also makes sense to store your actual table data in UTF-8, for example utf8_general_ci rather than latin1_swedish_ci , so that you can correctly process characters outside of the base latin letter -1.)

+4
source

Try changing the MySQL encoding to UTF-8 or Swedish.

Here is a small example.

0
source

All Articles