Skip to content
Advertisement

PHP Mailer languages encoding issues: It accepts only English

I am using php mailer at my website contact form. When i receive a message in greek language, i don’t receive the text as typed in the contact form. In class.phpmailer.php file line 59 the encoding is public $CharSet = 'iso-8859-1'; Is there a way to make my text appear correctly as typed in the contact form?

Languages comonly supported by ISO/IEC 8859-1 can be found here

I have also tried german and albanian languages but i also have the same problem. I can only receive english, if the user types another language on some words i receive “chinese”.

enter image description here

I get this message: enter image description here

The code:

JavaScript

Advertisement

Answer

In your example output, the char count amplification suggests that you’re receiving data from your form in UTF-8, but are then telling PHPMailer (by default) that it’s ISO-8859-1, which results in the kind of corruption you’re seeing.

You should be using UTF-8 everywhere. In PHPMailer you do it like this:

JavaScript

Then you need to be sure that every step of your processing supports UTF-8 as well.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement