PHP not encoding quoted_printable_encode correctly

227 Views Asked by At

I'm trying to add an emoticon(fire) in email subject. Below is the code I'm using:

$subject = "Test email \xF0\x9F\x94\xA5"; 
$charset = "UTF-8";
$subject = sprintf('=?%s?Q?%s?=', $charset, quoted_printable_encode($subject));
// send email....

This is adding a fire emoticon to the email subject successfully. But when I try to get the subject from database like:

$subject = $themeArray['templateSubject']; // Test email \xF0\x9F\x94\xA5 
$charset = "UTF-8";
$subject = sprintf('=?%s?Q?%s?=', $charset, quoted_printable_encode($subject));
// send email....

This is not converting the characters to emoticon. Instead I'm getting the subject in email as Test email \xF0\x9F\x94\xA5

Why its not converting when I get subject from database?

Can anyone help me to fix this? Thanks in advance.

0

There are 0 best solutions below