Accent on comment field

3

I need a help for a situation that seemed simple to me, I have a form with a comment field and when I send this comment by email it appears all unconfigured, I'm using phpMailer.

The code page on the contact page looks like this:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 

And in the process page I have tried some tips passed on, but none have successfully tried the utf8_decode, utf8_encode, '=? UTF-8? B?'. base64_encode ($ message). '? =', I already put on the process page the following codes:

ini_set('default_charset','UTF-8'); e
header(“Content-Type: text/html; charset=ISO-8859-1“,true) 

And it did not work either. Can anyone give me any tips?

    
asked by anonymous 20.06.2014 / 14:37

2 answers

7

If your page is actually charset iso-8859-1 , you can use the PHP function utf8_encode () (English) to encode it in UTF-8 .

Note:

In PHPMailer, you have to indicate the charset to be used to send the message:

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

In any case, the PHPMailer charset is the iso-8859-1 as seen in # This indicates that your page will not be in iso-8859-1 , at least the file that sends the email.

    
20.06.2014 / 15:08
4

As resolved in the comments:

The issue has been resolved by applying charset standardization to the relevant fields:

  • Code behind the page: call the function header with charset = utf-8 on all requests.
  • Save the documents in UTF-8 (you can convert an ISO-8859-1 to UTF-8 document with Notepad)
  • In the HTML file the meta tag that defines charset must be present and specify that the document is in UTF-8.
The HTTP request and response will now always be working in UTF-8, in the case of PHPMailer you can use the utf8_decode function to work with the messages if necessary or specify your CharSet attribute for UTF-8 (both forms perform a conversion process).

    
20.06.2014 / 18:43