我的json_encode函数存在一些字符编码问题:
我有javascript variable
为我存储一串文字:
<script type='text/javascript'>
postQuote = <?php echo json_encode($post['post_text']); ?>
</script>
$post['post_text']
取自MySQL数据库,正确显示。如果我打印出$post['post_text']
,编码就没有问题。
现在,字符串可以是:
You're doing great today? That's perfect.
现在postQuote
将输出:
You&#039;re doing great today? That&#039;s perfect
我该如何解决这个问题?