ahs10 Posted June 29, 2009 Share Posted June 29, 2009 i have the same script processing utf-8 characters from a mysql database and inserted into a form via an ajax request. submitting the form via post, i use the php mail function to send an email with these characters. this is done with several languages, the only one that does not work is the german emails subject line. why would just german not work properly? i would guess that the problem is going to be in the way i capture the characters from the form submission and mail them, so here's that part. i don't understand how some utf-8 characters work and others don't so maybe this isn't the section you need to see to help, please let me know if not. thanks! $to = html_entity_decode($_POST['couponSendEmail_to']); $from = html_entity_decode($_POST['couponSendEmail_from']); $bcc = html_entity_decode($_POST['couponSendEmail_bcc']); $subject = $_POST['couponSendEmail_subject']; $message = html_entity_decode($_POST['couponSendEmail_message']); $charset = 'UTF-8'; $encoded_subject = "=?$charset?B?" . base64_encode($subject) . "?=\n"; $headers = "From: " . $from . "\n" . "Bcc: " . $bcc . "\n" . "Content-Type: text/plain; charset=$charset; format=flowed\n" . "MIME-Version: 1.0\n" . "Content-Transfer-Encoding: 8bit\n" . "X-Mailer: PHP\n"; mail($to,$encoded_subject, $message,$headers); Link to comment https://forums.phpfreaks.com/topic/164101-utf-8-email-subject-japanese-works-german-does-not/ Share on other sites More sharing options...
ahs10 Posted June 29, 2009 Author Share Posted June 29, 2009 so after some further testing. i think the problem is occurring when i fetch the data from my db. i have the database encoded as utf8 and directly after i make a mysql connection, i have... mysql_query("SET NAMES utf8"); like i said the japanese version works fine. it is stored in the same table of the database, retrieved and mailed with the same script the german email is too. furthermore, the german email body (also stored in the same table) works just fine... it's just the subject line. please... anyone have any ideas? thanks for your time. Link to comment https://forums.phpfreaks.com/topic/164101-utf-8-email-subject-japanese-works-german-does-not/#findComment-865847 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.