Lately, we have transitioned our environment over to use UTF-8 encoding. Everything seemed to be working perfectly. Pages were being served up correctly in UTF-8 and email sent with PHP's mail() function were also being sent with (in our case) French characters appearing properly.
This morning, I started substituting non-multi-byte string functions (e.g., strlen(), mail()) with their multi-byte counterpart (e.g., mb_strlen(), mb_send_mail()) and it appears to be working as expected in all cases, except for mb_send_mail(), where French characters appear as question marks. Oddly, they appear correctly when using mail(). I also have the charset set to utf-8 in the email's headers in both cases, and checking it in my email client confirms that it is sent as such.
I should add that I am not using the Function Overloading feature, because I was concerned it would interfere with third-party extensions we are using, which is why I have chosen to replace the functions manually.
EDIT
These lines were modified/added in php.ini:
default_charset = "utf-8"
mbstring.language=Neutral
mbstring.internal_encoding=utf-8
mbstring.http_input=UTF-8
mbstring.http_output=UTF-8
mbstring.encoding_translation=On
My PHP files are also all saved in UTF-8 encoding, without BOM.
The code when calling the mb_send_mail() function looks like this:
$to = "person@email.com";
$subject = "Assigné";
$body = "La demande suivante vous a été assigné : "
$headers .= 'From: ' . $from . "
";
$headers .= 'MIME-Version: 1.0' . "
";
$headers .= 'Content-Type: text/html; charset="utf-8"' . "
";
$headers .= 'Content-Transfer-Encoding: quoted-printable' . "
";
if (!(@mb_send_mail($to, $subject, $body, $headers))) {
//Error message
}
As indicated in my original post, when using the mb_send_mail() function, all my e acute (é) characters, including the email's subject and bosy, appear as question marks (?), but when using the mail() function, they appear as intended.