I am having some character encoding issues with my json_encode function:
I have a javascript variable
which stores a string of text for me:
<script type='text/javascript'>
postQuote = <?php echo json_encode($post['post_text']); ?>
</script>
$post['post_text']
is taken from the MySQL database, where it shows correctly. If I just print out $post['post_text']
there will be no problem in the encoding.
Now, the string can example be:
You're doing great today? That's perfect.
Now the postQuote
will output:
You&#039;re doing great today? That&#039;s perfect
How can I solve this?