gpt4 book ai didi

php - header 显示为 UTF-8,但重音显示不正确 - 为什么? (php)

转载 作者:太空狗 更新时间:2023-10-29 13:40:38 25 4
gpt4 key购买 nike

为了清晰起见,我从一组更大的 php 文件中提取了 header 。当我将它加载到 Wampserver 时,<p>é</p>在网站上显示为 �,尽管 header 要求使用 utf-8 字符集。这份文件有什么问题?

(请注意,我试图通过将 iso-8859-1 替换为 utf-8 来修改编码,但没有帮助。)

header.php:

<?php
header('Content-Type:text/html; charset=UTF-8');
echo '<?xml version="1.0" encoding="iso-8859-1"?>'
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Blabla</title>
</head>
<body>
<p>é</p>
</body>
</html>

最佳答案

试试这个 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>在头部

同时检查你的文件编码

关于php - header 显示为 UTF-8,但重音显示不正确 - 为什么? (php),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5471902/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com