Form Encoding

Asked

Viewed 81 times

1

I have a form on a page that contains the following tag at the head

<meta charset="utf-8" />

The form is pointed to the page processa.php and at the top of that page I also put the tag <meta charset="utf-8" />

It turns out the emails I’m getting from this page processa.php are all with wrong accentuation, I’ve made several changes and everything is the same. which can be?

  • 1

    https://answall.com/questions/43193/d%C3%Bavida-com-charset-iso-8859-1-e-utf8/43205#43205

  • 1

    Not @13dev. If it uses BOM it will get much worse, because they are bytes that do not appear in any text editor. Only a large blank line will appear at the beginning of the HTML code if viewed through a browser. The ideal is to save UTF-8 Without BOM (UTF-8 encoding without byte markers). Notepad++ has this option, just download, install, open the files and go to Format and mark this option.

  • every reason @Tonymontana wanted to write without but thanks for the information, the sublime also offers this option

  • What you’re using to send these emails on the.php processing page?

  • i had a similar problem and solved it like this: on the header page("Content-Type: text/html; charset=UTF-8", true); And on the sending part $mail->Charset = 'iso-8859-1';

1 answer

0

If this code below does not work:

header("Content-Type: text/html; charset=UTF-8", true);

You may need to use another php feature that causes the variable to be encoded separately.

Ex.

$nome = utf8_encode($_POST['nome']);

If it doesn’t work try it:

$nome = utf8_decode($_POST['nome']);

If neither of these works, specify which sendmail library you are using in php.

If it is phpmailer you can solve so:

$mail->CharSet = 'utf-8';

Hugs!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.