UTF-8 Attachments
Posted: Tue Jan 15, 2008 2:27 am
Hi,
I contacted Chris via e-mail telling a problem I found using Swift Mailer.
He kindly replied me but as the forum is working now (it was several
days down, I think), I want to share what I found and ask for help.
I'm using the latest version (3.3.2). I have found a problem when
adding an attachment which has a name that needs utf8 charset.
I use the following sentence:
$message->attach(new Swift_Message_Attachment(new Swift_File($realpath), $realname));
Which I think is correct. The data is added fine to the raw email
body, but the name is encoded in a form that NO e-mail client can
read successfully, for example, the name of the attachment
"Presentación Congreso.doc" is encoded as:
Content-Type: application/octet-stream; name*=utf-8'en-us'Presentaci%C3%B3n%20Congreso.doc
Content-Transfer-Encoding: base64
Content-Description: =?utf-8?B?UHJlc2VudGFjacOzbiBDb25ncmVzby5kb2M=?=
Content-Disposition: attachment; filename*=utf-8'en-us'Presentaci%C3%B3n%20Congreso.doc
As the result, for example, GMail gives me as filename for that attachment:
utf-8'en-us'Presentaci%C3%B3n%20Congreso.doc
Same e-mail with Outlook Express does NOT allow to download the attachment, it even
renames the filename to: (note the ".dat" at the end)
Presentación Congreso.doc.dat
[greyed, unselectable]
Other webmails detect that there's an attachment but the name appears blank.
As I told you, I have yet to find a single e-mail client or webmail who knows
how to decode successfully this encoded filename or any other UTF-8 attachment
sent by Swift Mailer.
I am not saying the encoding method used is wrong, I just say that any popular e-mail
client I've checked doesn't show the attachment as it should.
To compare what the other e-mail clients do, see GMail:
Content-Disposition: attachment;
filename="=?UTF-8?Q?Presentaci=C3=B3n_Congreso.doc?="
So, is this a bug? can it be solved in any way I'm missing?
Thank you.
Marc LP
I contacted Chris via e-mail telling a problem I found using Swift Mailer.
He kindly replied me but as the forum is working now (it was several
days down, I think), I want to share what I found and ask for help.
I'm using the latest version (3.3.2). I have found a problem when
adding an attachment which has a name that needs utf8 charset.
I use the following sentence:
$message->attach(new Swift_Message_Attachment(new Swift_File($realpath), $realname));
Which I think is correct. The data is added fine to the raw email
body, but the name is encoded in a form that NO e-mail client can
read successfully, for example, the name of the attachment
"Presentación Congreso.doc" is encoded as:
Content-Type: application/octet-stream; name*=utf-8'en-us'Presentaci%C3%B3n%20Congreso.doc
Content-Transfer-Encoding: base64
Content-Description: =?utf-8?B?UHJlc2VudGFjacOzbiBDb25ncmVzby5kb2M=?=
Content-Disposition: attachment; filename*=utf-8'en-us'Presentaci%C3%B3n%20Congreso.doc
As the result, for example, GMail gives me as filename for that attachment:
utf-8'en-us'Presentaci%C3%B3n%20Congreso.doc
Same e-mail with Outlook Express does NOT allow to download the attachment, it even
renames the filename to: (note the ".dat" at the end)
Presentación Congreso.doc.dat
[greyed, unselectable]
Other webmails detect that there's an attachment but the name appears blank.
As I told you, I have yet to find a single e-mail client or webmail who knows
how to decode successfully this encoded filename or any other UTF-8 attachment
sent by Swift Mailer.
I am not saying the encoding method used is wrong, I just say that any popular e-mail
client I've checked doesn't show the attachment as it should.
To compare what the other e-mail clients do, see GMail:
Content-Disposition: attachment;
filename="=?UTF-8?Q?Presentaci=C3=B3n_Congreso.doc?="
So, is this a bug? can it be solved in any way I'm missing?
Thank you.
Marc LP