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.
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.
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.
This topic has been closed to new replies.