#1487808 closed Bugs (worksforme)
Attachments encoding problem
| Reported by: | nexus | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.6-beta |
| Component: | MIME parsing | Version: | 0.5.1 |
| Severity: | normal | Keywords: | Attachments encoding |
| Cc: |
Description
I have the latest (0.51) version of Roundcube and use RFC 2047/2231 attachment name settings. Also I use UTF-8 encoding as default.
Attachment file names encode fine in general but there are two exceptions:
- File name with underscore encodes incorrectly after sending but shows normally in upload frame. The same files show correctly in Roundcube if I send them from other client. So mail server works fine.
- ANSI encoded text files shows incorrectly after message body. And I don't even know how to disable function that shows them.
Thanks
Attachments (2)
Change History (16)
Changed 2 years ago by nexus
comment:1 Changed 2 years ago by alec
- Milestone changed from later to 0.6-beta
comment:2 Changed 2 years ago by nexus
File "test.eml" has been attached.
comment:3 Changed 2 years ago by alec
For some reason the attachment name in Content-Type header is not encoded at all. Are you using "dependent" Roundcube package? What version of Mail_Mime are you using?
Changed 2 years ago by nexus
comment:4 Changed 2 years ago by nexus
I'm sorry. How to know what version of Mail_Mime I'm using?
I haven't set anything Mail_Mime related settings.
comment:5 Changed 2 years ago by nexus
I have found file /program/lib/Mail/mime.php
It seems that version is "CVS: $Id: mime.php 4295 2010-12-01 10:49:20Z alec".
comment:6 Changed 2 years ago by alec
The file looks ok. It works for me. So, we'll need more info about your environment, PHP/OS version, etc.
comment:7 Changed 2 years ago by nexus
Windows 7, IIS, PHP 5.3.3. Anything else?
comment:8 Changed 2 years ago by alec
Content-Transfer-Encoding: base64 Content-Type: text/plain; name="Поздравительные_отк����ытки.txt" Content-Disposition: attachment; filename*0*=UTF-8''%D0%9F%D0%BE%D0%B7%D0%B4%D1%80%D0%B0%D0%B2%D0%B8%D1%82; filename*1*=%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5_%D0%BE%D1%82%D0%BA%EF%BF; filename*2*=%BD%EF%BF%BD%D1%8B%D1%82%D0%BA%D0%B8.txt
I see two issues here. 1. Why Content-Type contains non-encoded filename? 2. Why filename contains garbage characters %EF%BF%BD%EF? I have no idea.
comment:9 Changed 2 years ago by nexus
Where filename should be encoded in program code? Shall I provide debug information at this line?
Can you repeat this test on your machine with similar circumstances?
comment:10 Changed 2 years ago by alec
No, I'm unable to reproduce. I'm using linux, PHP 5.3.3/5.3.5. You could start debugging from program/lib/Mail/mimePart.php file and _builHeaderParam() function.
comment:11 Changed 2 years ago by nexus
Whole Mail_mimePart() function sets correct Content-Type headers.
In my case:
headers[Content-Type] = application/x-empty;
name="=?UTF-8?Q?=D0=9F=D0=BE=D0=B7=D0=B4=D1=80=D0=B0=D0=B2=D0=B8=D1=82?=
=?UTF-8?Q?=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=5F=D0=BE=D1=82=D0=BA=D1?=
=?UTF-8?Q?=80=D1=8B=D1=82=D0=BA=D0=B8=2Etxt?="
But for unknown reasons Content-Type headers rewrites by some another function higher in call stack.
Filename garbage characters returns _buildHeaderParam() function.
comment:12 Changed 2 years ago by nexus
I'm sorry. It was server-side issue. Mail server forcibly decoded filenames in headers. And did it incorrecly. So disabling this function solved the problem.
Alec I have some considerations of your second question about "filename" param: in my mail messages "name" and "filename" params are equal, so maybe "filename" is additional field for better compatibility with other servers/clients. If so it not a bug too. Nevertheless it certainly isn't a garbage characters)
Alec thank you for you help.
I know that ticket should be closed but I just can't realise one thing: now sending messages with attachment "Поздравительные_открытки.txt" to my server, Gmail, Yandex works fine but Mail.ru have the same problem at the same characters. I mean my server fails to decode UTF8 encoded filename properly and Mail.ru too. So I can't realise where is mistake in decoding operations? (It's exists right?)
comment:13 Changed 2 years ago by alec
- Resolution set to worksforme
- Status changed from new to closed
Show header and I'll tell you if they are properly encoded or not.
comment:14 Changed 2 years ago by nexus
There is a header:
--=_27c5b39c51662f7ff09a3e65577ae4d9
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=UTF-8;
format=flowed
Test
--=_27c5b39c51662f7ff09a3e65577ae4d9
Content-Transfer-Encoding: base64
Content-Type: application/x-empty;
name="=?UTF-8?Q?=D0=9F=D0=BE=D0=B7=D0=B4=D1=80=D0=B0=D0=B2=D0=B8=D1=82?=
=?UTF-8?Q?=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=5F=D0=BE=D1=82=D0=BA=D1?=
=?UTF-8?Q?=80=D1=8B=D1=82=D0=BA=D0=B8=2Etxt?="
Content-Disposition: attachment;
filename*0*=UTF-8%D0%9F%D0%BE%D0%B7%D0%B4%D1%80%D0%B0%D0%B2%D0%B8%D1%82;
filename*1*=%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5_%D0%BE%D1%82%D0%BA%D1%80;
filename*2*=%D1%8B%D1%82%D0%BA%D0%B8.txt
--=_27c5b39c51662f7ff09a3e65577ae4d9--

Please, attach message source.