special characters problem in email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

special characters problem in email

Post by itsmani1 »

Hi,

I am having a problem with characters like " é, å, ø " etc

I have textarea for message, users submit messages and when they use characters like above it does not show correctly in email.

any help?

thank you
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: special characters problem in email

Post by Darhazer »

First of all make sure that they come correct to the PHP script and the problem is in email only (i.e. output the e-mail to the browser, setting the correct encoding and if the browser is displaying correctly the characters, they are OK).

Second and most important: e-mail is in ASCII format. This means that all characters that are allowed are in the latin alphabet. To send UTF-8 messages, you have to encode your mail in base64, set the Content-Encoding header to base64 and the Content-Type header to text/plain;charset=utf8

The really tricky part is if you want to use special characters in the headers, because you have to encode them as well, but if you use them only in the message body, it's easy task.
Post Reply