"Laangen_LU" <pa**********@gmail.comwrote:
my first post to this group, so if I'm on the wrong group, my
apologies.
I'm trying to send out an email in Chinese lanuage using the mail()
function in PHP.
Subject and mailbody are stored as Unicode entities (eg. 註)
The mail body renders perfectly in all tested emailclients if the mail
is sent as html.
Only the subject displays the entities but does not render the Chinese
chars.
Any ideas on how to get the mail sent with the subject displaying
correctly?
Thank you in advance for any clue available on this topic.
The "Subject" field can be encoded as MIME header (see RFC 2045-2048).
For example, given the subject $subj encoded as a UTF-8 string,
a possible encoding might be
define("ENCODING", "UTF-8");
$header = "Subject: =?" . ENCODING . "?B?" . base64_encode($subj) . "?=\r\n";
Note that the RFC 2047 sets a limit to the maximum lenght of the resulting
string. Beyond that limit the string must be splitted somewere. However,
the email clients I tested are able to accept a string of any length,
so this is a problem you may ignore as a first step of the implementation.
And note that this encoding has nothing to do with the Content-Type
field or the body of the message.
Obviously, your "Unicode entities" must be converted to regular UTF-8
characters before the Base64 encoding be applied.
Regards,
___
/_|_\ Umberto Salsi
\/_\/
www.icosaedro.it