Dakkadakka
Dakkadakka

Reputation: 51

Display HTML copyright and restricted symbols

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?

Upvotes: 0

Views: 1346

Answers (1)

Marty McVry
Marty McVry

Reputation: 2856

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

PHP Manual for htmlentities()

Upvotes: 1

Related Questions