PHP base64_decode! "@" comes out as a "¡"

327 Views Asked by At

I am pulling some code from an email (google) and it translates the code or encrypts it when I use an @ symbol it changes to and upside down explanation point.¡ I use the code below and it fixes it back to the @ symbol but it adds a "?" and the end or a "n". It also changes the $ to a funky symbol. Any ideas how to decode this properly? Again its a Google encryption. Don't know if that helps...

$Body = base64_decode($Body);
$Body = mb_convert_encoding($Body, "utf-8");
$Body = htmlspecialchars($Body);
$Body = preg_replace('/¡/',"@",$Body);
1

There are 1 best solutions below

1
On

I use this for fetching my email body from gmail.

$body = imap_fetchbody($inbox, $mail, 1);
$body = quoted_printable_decode($body);
$body = urldecode($body);

And it's work well