Hi there
I made a php file in order to sent a message from a my page website form.
Despite the fact that I transformed the file from ANSI to UTF-8 unicode, when a send a message with text in Portuguese or French, or any other characters does not appear correctly: é ão ção
The fixed words it appears ok due the fact I used the special codes like “á” and so on for the characters, but whatever the end user rights the funny characters appears.
What is the solution?
I’m send you here the script.
Thanks a lot
PHP Code:
<? session_start(); if( $_SESSION['security_code'] == $_POST['sec'] && !empty($_SESSION['security_code'] ) ) { $adminaddress = "e@wmail.pt"; $siteaddress ="www.website.pt"; $sitename = "Company- PORTUGAL"; $date = date("m/d/Y H:i:s"); $de= " \"Company- PORTUGAL\" <e@mail.pt>"; if ($_SERVER['REMOTE_ADDR'] == ""){ $ip = "no ip"; } else { $ip = $_SERVER['REMOTE_ADDR']; } $email = $_POST['email'] ; $telefone= $_POST['telefone']; $name = $_POST['nome'] ; $company = $_POST['company']; $comments = $_POST['comments'] ; $assunto1="Mensagem de Visitante"; $assunto2="Obrigado por visitar $siteaddress"; if(!$email){ header("location: contact.php?resposta=Todos os campos devem ser preenchidos. Email deve ser válido"); die(); } $message="<html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> </head> <body> <table width='700' border='0' align='center' bgcolor='#e0e0e0' cellpadding='0' cellspacing='0'> <tr> <td align='right' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff3300' size='5'><b>WEB</b></font><font face='arial' color='#ff0066' size='5'><b>SITE</b></font> </td> <td width='67' align='left' valign='top' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>®</b></font></td> <td width='67' align='left' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>PORTUGAL</b></font></td> <td colspan='3' align='left' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='2'><b> Games</b></font></td> </tr> <tr> <td colspan='6' align='center'> </td> </tr> <tr> <td width='147' align='center' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'><b>Endereço:</b></font></td> <td colspan='3' align='center' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'><b>$adminaddress</b></font></td> <td width='16' align='center'> </td> <td align='center' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'><b>Solicitação de Informação</b></font></td> </tr> <tr> <td colspan='6' align='center'> </td> </tr> <tr> <td colspan='6' align='center'><font face='arial' color='#000000' size='3'><b>Um visitante deixou a seguinte Informação\n</b></font></td> </tr> <tr> <td colspan='6' align='center'> </td> </tr> <tr> <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Nome:</font></td> <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'> $nome</font></td> <td align='center'> </td> <td align='center' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Comentário:</font></td> </tr> <tr> <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Email</font></td> <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'> $email;</font></td> <td align='center'> </td> <td rowspan='5' align='justify' valign='top' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>$comments</font></td> </tr> <tr> <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Telefone:</font></td> <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'> $telefone</font></td> <td align='center'> </td> </tr> <tr> <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'></font><font face 'arial' color='#000000' size='3'>Empresa:</font></td> <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'> $company\n</font></td> <td align='center'> </td> </tr> <td colspan='5'> </td> </tr> </table></td> </tr> </table> </body> </html>"; $message2="<html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> </head> <body><table width='700' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#e0e0e0'> <tr> <td width='232' align='right' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff3300' size='5'><b>WEB</b></font><font face='arial' color='#ff0066' size='5'><b>SITE</b></font></td> <td width='35' align='left' valign='top' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>®</b></font></td> <td width='419' colspan='3' align='left' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>PORTUGAL</b></font> <font face='arial' color='#000000' size='2'><b>Games</b></font></td> </tr> <tr> <td colspan='5' align='center' bgcolor='#33FF66'><font face='arial' color='#000000' size='3'> </font></td> </tr> <tr> <td colspan='5' align='center'> </td> </tr> <tr> <td colspan='5' align='center' bgcolor='#c6c6c6'><table width='680' border='0' cellspacing='0' cellpadding='0'> <tr> <td colspan='2' align= right>Usando: </td> <td width='10'> </td> <td width='374'> $HTTP_USER_AGENT</td> </tr> <tr> <td colspan='2' align='right'>Hostname: </td> <td> </td> <td> $ip</td> </tr> <tr> <td colspan='2' align='right'>Endereço: </td> <td> </td> <td> $REMOTE_ADDR</td> </tr> <tr> <td colspan='2' align='right'>Data/Hora: </td> <td> </td> <td> $date</td> </tr> <tr> <td colspan='2' align='right'>De: </td> <td> </td> <td> $adminaddress</td> </tr> <tr> <td colspan='2' align='right'>Email</td> <td> </td> <td> $email</td> </tr> <tr> <td colspan='4'> </td> </tr> <tr> <td align='right'> Exmo(a)</td> <td colspan='3' align='left'> $name</td> </tr> <tr> <td align='right'> </td> <td colspan='3' align='left'> </td> </tr> <tr> <td width='161' align='right'> </td> <td colspan='3' align='left'> Obrigados pela sua visita</td> </tr> <tr> <td align='right'> </td> <td colspan='3' align='left'> Entraremos brevemente em contacto consigo.</td> </tr> <tr> <td align='right'> </td> <td colspan='3' align='left'> </td> </tr> <tr> <td align='right'> </td> <td colspan='3' align='left'> Cumprimentos</td> </tr> <tr> <td align='right'> </td> <td colspan='3' align='left'> </td> </tr> <tr> <td align='right'> </td> <td colspan='3' align='left'><a href=\"$siteaddress\" target=\"_blank\">$de</a></td> </tr> <td colspan='4'> </td> </tr> </table></td> </tr> </table></body></html>"; mail ($adminaddress, $assunto1, $message, "From:".$de."\nContent-Type: text/html;\n"); mail ($email, $assunto2, $message2, "From:".$de."\nContent-Type: text/html;\n"); header("location: contact.php?resposta=Contacto enviado com sucesso.<br>Obrigados<br>Ir´ receber confirmação dentro de momentos..."); die(); } else { header("location: contact.php?resposta=Código inválido, por favor tente novamente!"); die(); } ?>
|