开发者

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 utf8_encode()) and prepend the following header:

$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');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜