联系表格中的特殊字符 [英] special characters in contact form

查看:79
本文介绍了联系表格中的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此联系表,但问题是我的邮件中没有特殊字符(šđžćč或ÁÁÂÃÄÅÅ...)。

I have this contact form and the problem is I dont get special characers in my mail (šđžćč or ÀÁÂÃÄÅ...).

index.php:

index.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form method="post" action="contactengine.php">
<label for="Name">Name:</label>
<input type="text" name="Name" />
<label for="City">City:</label>
<input type="text" name="City" />
<label for="Email">Email:</label>
<input type="text" name="Email" />
<label for="Message">Message:</label>
<textarea name="Message" rows="20" cols="20"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
</form>
</body>
</html>

contactengine.php:

contactengine.php:

<?php
$EmailFrom = "example@example.com";
$EmailTo = "example@example.com";
$Subject = "subject";
$Name = Trim(stripslashes($_POST['Name'])); 
$City = Trim(stripslashes($_POST['City'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Message = Trim(stripslashes($_POST['Message'])); 
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
?>

我已经在互联网上搜索了解决方案,但没有找到能解决我问题的方法。
有人知道我必须插入什么代码吗?

I have searched on internet for solution but didn't find any that resolved my problem. Does someone know what code do i have to insert?

推荐答案

stripslashes()打破UTF-8特殊字符。

stripslashes() breaks UTF-8 special characters.

我认为您最好将所有 magic_quotes _ * 在您的php.ini中关闭(它们会添加很多无用的斜杠)。

I think you'd better set all magic_quotes_* to off in your php.ini (they add a lot of "useless" slashes) .

这篇关于联系表格中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆