View Full Version : Unicode through php mail()

08-09-2007, 10:58 AM
Hi all,

I've a feedback form which sends email to a specific mail-id. I'm using the class.phpmailer.php obtained from http://phpmailer.sourceforge.net/

I can send plain english text through this, but when I tried to send some unicode text, I get texts like .....%u0D06%u0D26%u0D4D%u0D2F%........

I would like to know anybody have used this class and any solution to this problem.

Or please let me know some other solutions.

Edit: There are two attributes for the class, var $CharSet = "iso-8859-1"; and var $Encoding = "8bit";. I think something to do with them. But I don't know how...


08-09-2007, 06:34 PM
I've tried simply like with out using the phpmailer class

$body = chunk_split(base64_encode($Brief));
mb_send_mail("mail@domain.com", $Subject, $body,$headers);

and then tried to change the encoding and charset variable in the class also.

But no progress has been made yet. I hope someone have the solution.

please help me.

08-10-2007, 01:59 PM
OK, even though I'm a little disappointed to have no comments on this thread(I'm not sure about the reason), let me say about the partial solution( and some additions to the original post )

1)I've changed the encoding of the page from the default ANSI to utf-8.
2) Changed the value of the var $CharSet from "iso-8859-1" to "utf-8" in the class.
3) Put a wrap of <p style="Suitable font"></p> over the submitted message.

Now, I can read the message clearly, but have some problem to read the subject since I couldn't effectively enclose the subject as in the case of body. (It might be due to the encoding of subject done in the class to prevent html entities )

Firstly I had an AJAX form to send mail, but now it's not working. I believe it's due to BOM came with utf-8 encoding.

Please correct me if I'm missing anything and any suggestion to work AJAX in a utf-8 encoded file is much appreciated.


08-10-2007, 02:07 PM
Can't you use Prototype (http://www.prototypejs.org) (the javascript framework) to help you with your Ajax problems?

08-10-2007, 02:26 PM
Thanks for the link, I'll have a try!

but I think you mean http://www.prototypejs.org instead of .com

Edit:Currently I'm using the techniques from http://absinth.modernmethod.com/sajax/

08-12-2007, 12:53 PM
You will be correct. Evidently, I that wasn't copy and pasted. :) I'm glad you found it tho, how is it coming for you?

I think that sajax is to early in its development stages to use anywhere in a non-developmental environment.

08-13-2007, 06:23 PM
Let me re ask my question (based on current problem)...

Is there any built in function available to convert a u+hexadecimal to its unicode character equivalent?

(say, I want to convert ...%u0D06... to ...ആ... )

Please give some hint.


08-14-2007, 01:52 AM
Unfortunately, I haven't dabbled in character encoding yet. Perhaps a quick glance at the online manual will prove profitable. Or even better, someone can come in here and add their input.