I'm trying to parse UTF-8 encoded emails but the end result still brings ascii characters such as below:
<div>Contact =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0:=C2=A0Acme=C2=A0Xpto<br/>Phone =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
My understanding is that C2 A0 should be translated to space, but I can't get it to work in PHP.
Here is a relevant snippet from my code:
$fd = fopen("php://stdin", "r");
while (!feof($fd)) {
$line = utf8_encode(fread($fd,1024));
print $line
}
The email comes through a .forward in the users' home dir:
$ more .forward
"| /usr/bin/php /home/adm/process-email.php"
My guess here is that when the email is processed through the pipe, it's translated into asc characters and I'm not reading the original UTF-8 encoded file in my php script.
Any hints on how I could solve this issue?
Thanks