【发布时间】:2014-09-04 20:42:52
【问题描述】:
我的编码有问题,我尝试使用 CodeIgniter 将我的 html 转换为 utf8,所以我的代码是:
public function generateTitlePage($company)
{
$this->load->library('dompdf_gen');
$dompdf = new DOMPDF();
$search = array('%27', '%20', '%C3%A2', '%C3%AE');
$replace = array('', ' ', 'â', 'î');
$company = str_replace($search, $replace, $company);
$html = '
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<div style="margin-top:20px;text-align: center;font-weight: bold">
LIMITATĂ'.$company.'
</div>
</body>
</html>
';
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("welcome.pdf");
}
那么,我的输出 pdf 是 LIMITAT 吗?公司名称,我不明白为什么不转换 Ă 是使用元标记,我也使用 Codeigniter config: $config['charset'] = 'UTF-8';帮帮我,请提前谢谢
【问题讨论】:
标签: php codeigniter utf-8 codeigniter-2 utf8-decode