For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > February 2007 > mail() function and accented characters









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mail() function and accented characters
Jean-Guy Mouton

2007-02-05, 6:58 pm

Hello,

I have a very simple form with 3 fields on a Web page and one of them is a
comment field. I use the mail() function to send it. My problem is that the
comment arrives with weird characters instead of the accented characters.

Is there a simple way in PHP to encode the message so that it arrives with
correct accented characters in the email client?

Thank you.
OmegaJunior

2007-02-05, 6:58 pm

On Mon, 05 Feb 2007 20:03:41 +0100, Jean-Guy Mouton <nospam@nospam.com>
wrote:

> Hello,
>
> I have a very simple form with 3 fields on a Web page and one of them is
> a
> comment field. I use the mail() function to send it. My problem is that
> the
> comment arrives with weird characters instead of the accented characters.
>
> Is there a simple way in PHP to encode the message so that it arrives
> with
> correct accented characters in the email client?
>
> Thank you.


If I'm not mistaken this is what uuencoding does.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Manuel Lemos

2007-02-05, 6:58 pm

Hello,

on 02/05/2007 05:03 PM Jean-Guy Mouton said the following:
> Hello,
>
> I have a very simple form with 3 fields on a Web page and one of them is a
> comment field. I use the mail() function to send it. My problem is that the
> comment arrives with weird characters instead of the accented characters.
>
> Is there a simple way in PHP to encode the message so that it arrives with
> correct accented characters in the email client?


Yes, you need to use q-encoding for non-ASCII characters in the headers
and quoted-printable encoding in the body.

There are RFC that explain that, but it is not a trivial standard
specification. You may want to try a ready to use class to encode the
message as you need in the character set you use, like for instance the
MIME message composing and sending class:

http://www.phpclasses.org/mimemessage


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com