PHP convert html special chars like accents to show properly -
i have simple web page data $_post users input: comments, usernames, etc. , send them email , save them on database. problem when send email, doesn't matter client is, see gibberish. tried declaring meta tag in emails iso 88xx, utf8, windows, etc., no success. tried million examples of htmlentities(), leading same thing... plain gibberish. (althought source code shows different things sometimes, plain text never changes).
example code:
if (isset($_post['name'])) { $name = htmlentities($_post['name'], ent_quotes); }
a result of mail() of $name (don quijóte) "don quijóte".
sorry if repost can't working.
have tried setting headers, like...
// set content-type when sending html email $headers = "mime-version: 1.0" . "\r\n"; $headers .= "content-type:plain/text;charset=utf-8" . "\r\n"; mail($to,$subject,$message,$headers);
this sets encoding utf-8. more here: http://www.w3schools.com/php/func_mail_mail.asp
Comments
Post a Comment