我有下面的html,其中有两个php函数,可以渲染PDF:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<div>
Summary:<?php echo get_post_meta(get_the_ID(), 'summary', true); ?>
</div>
<div class="post-content">
Content:<?php utf8_encode(the_content()); ?>
</div>
</body>
</html>
它们都有相同的内容,但输出不同。
摘要打印:
总结:让我们走出
内容打印:
内容:让?s退出
这让我相信是调用中的某些东西影响了utf-8解码。两个数据库表都使用:CHARSET=utf8
如何使内容部分正确呈现?
检查utf8编码函数是否有帮助http://php.net/manual/en/function.utf8-encode.php