PHP language problem
I have a php page that sends mails to a specific email with the data included in the form on this page. The mail has to be sent in the native language of the website (Arabic)开发者_如何学Python but when I click the submit button on the form, the mail is received half readable (Arabic language) and the other part is unreadable (Symbols). I want to know how to solve this problem and be able to send the mail to be all readable in the native language? (except for user-input symbols)
Encode your message as UTF-8 (see and prepend the following header:utf8_encode()
)
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/plain; charset=UTF-8' . "\r\n";
// example
mail($to, $subject, $message, $header . $more_headers);
EDIT:
Use mb_convert_encoding()
to convert your message to utf8, from whatever encoding it's currently on:
$str = mb_convert_encoding($str, 'UTF-8');
精彩评论