I am storing a registered trademark symbol with a product name in a mysql table. The table is utf8 unicode. When I render the page using Smarty templates I see Product®
when I should be seeing Product®
.
After stepping through I can see the right before the template is rendered the variable looks like Product®
but after render it adds the strange Â
character. I also tested this by using the php utf8_encode()
and can visibly see the character being added after the encoding.
How do I strip this character and render so it isn't shown. I've tried something like this:
$product= str_replace('®', '®', $product);
$product= html_entity_decode($product);
But still see the strange Â
character show up in the product name. I have seen different issues on SO regarding a similar character but now solutions as to how to deal with it.
Sounds like "Mojibake", where ®
becomes ®
.
This discusses the various causes for such: Trouble with UTF-8 characters; what I see is not what I stored
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.