Can't get special characters working (php mail contact form)

Hi,

I’ve tried many things, but don’t have any clue what could be wrong with code. Special characters are not showing in Thunderbird on computer, but are showing in hotmail/gmail. Here’s the complete code I use:

<!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>
<META HTTP-EQUIV="refresh" content="0;URL=thank-you-for-message.html">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you for your message</title>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-XXXXXXXX-X', 'domain.com');
  ga('send', 'pageview');

</script>
</head>
<body>
<?php
iconv_set_encoding("internal_encoding", "utf-8");
$name = $_POST['nameSurname'];
$address = $_POST['address'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$how = $_POST['how'];
$subject = $_POST['subjectcontent'];
$message = $_POST['message'];

$to  = 'some@email.com' . ', ';
$subject = "".$subjectcontent."";
$message = "THIS MESSAGE IS SENT FROM ONLINE CONTACT FORM\
"
            ."-------------------------------------------------------------------------------------------\
"
            ."\
"
						."NAME:\
"
            .$name."\
"
            ."\
"
            ."FULL ADDRESS:\
"
						.$address."\
"
						."\
"
						."E-MAIL:\
"
						.$email."\
"
						."\
"
			      ."PHONE:\
"
						.$phone."\
"
						."\
"
			      ."YOU MAY CONTACT ME:\
"
						.$how."\
"
						."\
"
            ."MESSAGE:\
"
            .$message. ;

$headers  = "MIME-Version: 1.0" . "\\r\
";
$headers .= "Content-type:text/html;charset=utf-8" . "\\r\
";
$headers .= "Content-Transfer-Encoding: 8bit\
";
$headers = "From:" .$email. "\\r\
";
						
mail($to,$subject,$message,$headers);
?> 
</body>
</html>

I’ve tried so many things that I don’t know anymore what I’ve tired. It’s really start getting very annoying, as I can’t find any solution for this.

Kind regards :wink:

Could you give some more information? What special characters are you talking about?

I’m talking about special characters ČŽŠčćžšđäÄéöÖüÜß (German, Italian, Croatian)…

I don’t see those characters in your code. That’s not what I meant by more information. Where are you trying to use these characters, and how, and all that ?

I’ve translated some text in the code and I use this form in four different languages (they are in different folders - EN/DE/IT/HR). I’ve have contact form on html page, when user clicks on send button, data is sent to send-email.php file (the code that I’ve published above) and then that page redirects user to “thank you for your message” page. Most special characters are entered into the form when filling out the contact form on website. Users enter special characters of three languages (German, Croatian and Italian) - some of these are: ČŽŠčćžšđäÄéöÖüÜß.

I hope you got enough information now…

Sadly I still didn’t find any solution… I would just like to add that I don’t use MySql to store messages.