Euro sign not showing on site

后端 未结 3 723
说谎
说谎 2021-01-18 00:07

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

However, when I try to echo it in an input fie

相关标签:
3条回答
  • 2021-01-18 00:35

    Try to change the MySQL charset to UTF-8 or to Swedish.

    Here it is a small example.

    0 讨论(0)
  • 2021-01-18 00:47

    If you are serving the page as UTF-8, you will need to ensure you grab the string out of the database in the UTF-8 encoding before putting it on the page. You can do that using:

    mysql_set_charset('utf8');
    

    (If you're doing that it would also make sense to store your actual table data in UTF-8 too, eg utf8_general_ci, rather than latin1_swedish_ci, so you can deal properly with characters outside of the basic Latin-1 set.)

    0 讨论(0)
  • 2021-01-18 00:51

    Try using htmlentities() instead of htmlspecialchars().

    Special chars does not convert everything, just a few select characters. The Euro symbol €, needs to be encoded really, €.

    0 讨论(0)
提交回复
热议问题