WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have integrated tinymce editor of wordpress to my custom plugin. I save the data entered in to Database via ajax like this:

encodeURIComponent('<?php echo mysql_real_escape_string(stripslashes($_POST['title'])); ?>');

But in frontend as well as in DataBase Custom Characters like diamond etc are stored and displayed as question mark.

share|improve this question

You have to encode the string you store in UTF-8 or whatever the site is using as encoding.

If you don’t store valid UTF-8 you get the famous diamonds. In websites, these are not girls best friends, they just break your output. :)

See this answer for some code to encode text as UTF-8 in PHP.

share|improve this answer
Diamonds may be forever, but so are encoding conflicts ;) – Eric Holmes Apr 4 '14 at 12:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.