Reputation: 51
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
® and ©
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
Reputation: 2856
You have 2 options: either change the character encoding, or use the PHP htmlentities()-function.
Upvotes: 1