Support » Fixing WordPress » special character code ’ instead of apostraphe

  • Resolved jeremyduffy


    This is a hard problem to diagnose. I am trying to send a page title to a Javascript variable but it’s showing that darned html character code or utf8 char code. How do I get rid of it? There must be a wordpress function or something that does this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi


    Forum Moderator

    Could you run something like urldecode or html-entity-decode on the title to decode the special characters before passing them onto your javascript?

    I tried both and no dice. The character code didn’t come through in my original comment which is also why it’s hard to search on, but it’s & #8217;

    I don’t know how to make it a regular apostrophe again, but using this:

    return html_entity_decode($string, ENT_QUOTES, ‘UTF-8’)

    I was able to get it to at least a funky character code that looks like an apostrophe. It works for now anyway.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘special character code ’ instead of apostraphe’ is closed to new replies.