html/php联系人表单中的变异元音(umlauts)问题

html/php联系人表单中的变异元音(umlauts)问题,php,html,utf-8,contact-form,Php,Html,Utf 8,Contact Form,德语变异元音ö、ä、ü等在通过html/php联系人表单发送的电子邮件中显示不正确,即使设置了UTF-8声明 PHP文件: <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" /> <?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $

德语变异元音ö、ä、ü等在通过html/php联系人表单发送的电子邮件中显示不正确,即使设置了UTF-8声明

PHP文件:

    <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
<?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $from = 'From: Website'; 
    $to = 'xxx@gmx.de'; 
    $subject = 'Hi there';
    $human = $_POST['human'];

    $body = "From: $name\n E-Mail: $email\n Message:\n $message";
    if ($_POST['submit']) {
    if ($name != '' && $email != '')
html文件中还设置了utf声明:

<!DOCTYPE html>
<meta charset="utf-8">
特殊字符如下所示。对于php,您需要使用header函数来确保HTTP header设置为UTF-8

试试链接

简言之:

标题的内容类型:text/html;字符集=utf-8'; 在require和import语句之后发送任何数据之前调用此函数