Signs of Spanish accent in presentation form

I have a form where Spanish can be submitted and using PHP, I send an email with the data. Unfortunately, accent marks are completely upside down when they receive email.

If I send the following:

Accent Testing Γ‘ Γ© i Γ³ ΓΊ p

I get the following in the body of the letter ...

Accent Testing ÃÃ Γƒ Β© ó ú Γƒ Β±

The email processing code simply puts the $ _POST information directly into the body of the email. I assume I need htmlentities () or something, but I tried and nothing works ...

I will also need to put the same data into the MySQL database and retrieve it later. What do I need to know when I do this?

Thank! Drew

+3
4

. utf-8. , , . , , utf-8. 7- 8- .

"Content-Type: text/plain; charset=utf-8"
"Content-Transfer-Encoding: 8bit"

mysql .

+3

:

, MySQL mysql_connect(), :

mysql_query("SET NAMES utf8");

( mysqli_query(), ).

MySQL , :

  • , , UTF-8
  • UTF-8.

, (MySQL ), , , UTF-8.

+1

utf8, base64 :

$subject = "=?utf-8?b?".base64_encode($subject)."?=";

:

$headers.="Content-Type: text/html; charset=utf-8\r\n";

​​, SwiftMailer, . , , , .

0

Your script receives the data encoded in UTF-8, but your mail client believes that the letter is encoded in Latin-1. There are two ways to do this: add a heading to the letter indicating that the character encoding is UTF-8, or use it utf8_decode()in the content provided (if you are sure that you will use only Latin-1 characters).

0
source

All Articles