PHP包含和重音符号(它们显示为;)
我使用PHPClude来包含一个包含HTML的PHP文件。一些内容带有法语口音,这些内容显示为� 在网站上。如何解决这个问题 谢谢 以下是我包含的PHP文件:PHP包含和重音符号(它们显示为;),php,character-encoding,Php,Character Encoding,我使用PHPClude来包含一个包含HTML的PHP文件。一些内容带有法语口音,这些内容显示为� 在网站上。如何解决这个问题 谢谢 以下是我包含的PHP文件: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" xmlns="http://www.w3.or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<title>Accueil</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="Changement créativité rêve buts être centré Plénitude personnel Développement transformation Modification nouveauté avancement bien-être Nouvelle vision ressentis L’énergie positive satisfaction l’acceptation Pardon" name="keywords" />
<link href="masterstyles.css" rel="stylesheet" type="text/css" />
<link href="menustyles.css" rel="stylesheet" type="text/css" />
<link href="menudropdown.css" rel="stylesheet" type="text/css" />
<td class="tbsyles" >
<h3 class="bigorange"> ACTIVITÉS À VENIR…</h3>
<p class="horizblue"> </p>
<p class="bigblack"> <br />
Inscrivez-vous à nos conférences et formations
<br />
<br />
</p>
<h4 class="orange"> Example of some text that could be here<br />
</h4>
<p class="horizblue"> </p>
<h3 class="bigorange"> <br />
ABONNEZ-VOUS… </h3>
<p class="nopadding"> À notre liste d’envoi </p>
<form method="post" action="<?php echo $PHP_SELF;?>">
<?PHP
function process_info(){
if(isset($_POST['email']))
{
$email=$_POST["email"];
$email=strtolower($email);
$action = "subc";
// check if email exists
// check whether email is correct (basic checking)
$test1=strpos($email, "@"); //value must be >1
$test2=strpos(substr($email,strpos($email,"@")), "."); //value must be >1
$test3=strlen($email); //value must be >6
$test4=substr_count ($email,"@"); //value must be 1
if ($test1<2 or $test2<2 or $test3<7 or $test4!=1)
{
print "<h6>Il a une erreur avec vôtre email</h6>";
print "<h6>Aucune informations ont été envoyer</h6>";
}
else
{
print "<h5>vôtre address est enregistrer, Merci </h5>";
//If they wanted to subsribe, do it...
$file = "emaillist-666XXX.txt";
// lets try to get the content of the file
if (file_exists($file)){
// If the file is already in the server, its content is pasted to variable $file_content
$file_content=file_get_contents($file);
}
else{
// If the file does not exists, lets try to create it
// In case file can not be created (probably due to problems with directory permissions),
// the users is informed (the first user will be the webmaster, who must solve the problem).
$cf = fopen($file, "w") or die("");
fclose($cf);
}
// IF REQUEST HAS BEEN TO SUBSCRIBE FROM MAILING LIST, ADD EMAIL TO THE FILE
if ($action=="subc"){
// check whether the email is already registered
if(strpos($file_content,"<$email>")>0){die("");}
// write the email to the list (append it to the file)
$cf = fopen($file, "a");
fputs($cf, "\n$email"); // new email is written to the file in a new line
fclose($cf);
}
}
}
}
process_info();
?>
<p class="nopadding">Votre Courriel</p>
<input name="email" type="text" class="style3" />
<input name="Submit" type="submit" value="OK" /></form>
<p class="horizblue"></p>
<h3 class="bigorange"> <br />
OUTILS GRATUIT… </h3>
<p class="nopadding">Amusez-vous avec des outils intéressants</p>
</td>
阿奎尔
维尼尔行动…
在这里,你有什么意见和看法
此处可能出现的某些文本示例
阿伯内兹-你…
不重新列入
HTML页面的字符集是什么?听起来PHP文件的字符集和其中的HTML不同。您可能想签出:
要获得更多帮助,请发布一些代码,特别是要输出的doctype和对PHP字符集函数的任何调用。如果浏览器认为您使用的编码与实际使用的编码不同,则会发生这种情况
在打印任何html之前,请尝试在php文件中添加以下内容:
header ('Content-type: text/html; charset=utf-8');
// or
header ('Content-type: text/html; charset=iso8859-15');
加
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- or -->
<meta http-equiv="Content-Type" content="text/html; charset=ISO8859-15" />
在
标记之间
更新:刚刚看到您的文件更新。您需要添加标题('Content-type:text/html;charset=utf-8')代码>如果切换字符集无法修复它,则可以使用实体<代码>é代码>foré,ô代码>等
另外,“Il a une erreur avecvôtreemail”->你应该说“Il y a”,它不是vôtre,email可以翻译成“courriel”:)尝试使用
<meta http-equiv="Content-Language" content="fr"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
我对一家法国酒店的网站也有同样的问题
将字符集改为“ISO-8859-1”而不是“UTF-8”成功了
示例: