Display HTML copyright and restricted symbols

1.3k Views Asked by At

The MySQL database I am working with sometimes has items with copyright and restricted characters beside their brand name. Which is fine, but when items are printed as HTML, the copyright symbol and restricted symbol both appear as a diamond with "?" inside of it, indicating it's not properly printing as HTML. From this reference http://www.shopfitter.com/html-special-characters.htm

The Registered Trademark symbol and copyright symbol needs to be

&reg and &copy

respectively. A string replace in PHP would get rid of this quick, but I'm not sure how to write what I'm looking for if it's becoming a '?' diamond.

How can I properly detect and replace these characters in the database with their web friendly counterparts?

1

There are 1 best solutions below

0
On

You have 2 options: either change the character encoding, or use the PHP htmlentities()-function.

PHP Manual for htmlentities()