1

German mutated vowels (ö,ä,ü, etc) are not displayed correctly in the emails, sent over a html/php contact-form even the the UTF-8 declaration is set.

PHP file:

    <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 != '')

In the html file the utf declaration is set as well:

<!DOCTYPE html>
<meta charset="utf-8">

The special characters looks like this "ü"

peachmeier
  • 11
  • 2

1 Answers1

-1

For php you need to use the header function to make sure that the HTTP header is set to UTF-8.

Try this link.

In a nutshell:

header('Content-Type: text/html; charset=utf-8');

Call this before any data is sent (right after your require and import statements).

Marko Vejnovic
  • 45
  • 1
  • 12