Community Forums 

Main Content

Special Character Weirdness

    Mar 13 2012 19:15:21



    Join date : 2008-09-18      Posts : 28

    Some of the items that are being added to this cart have a "dash" in the item name, and the dash is showing up as — in the cart. The source code of the item page shows the character t as (amp)(pound)8211(semi).

    The encoding on the page is UTF-8 and I can't change that because it's a part of a CMS and doing that will throw off other things.

    I tried using html_entity_decode() on the item name as it is being pulled down from the data table, that didn't work even though it's showing up on the page and the source code as a dash eith no encoding. Tried using mdash, that didn't work, either.

    Anybody have any other ideas?

    Mar 14 2012 12:07:33



    Join date : 2008-09-18      Posts : 488

    Instead of decoding it, replace it with a minus sign using str_replace.

    Mar 14 2012 14:23:24



    Join date : 2008-09-18      Posts : 28

    Thanks for the suggestion, anon. You got me headed down the right track.

    Had to use html_entity_decode() and then run it through a str_replace() for the character encoding.

    Voila! No more weird characters in the cart!