Opened 3 years ago

Closed 2 years ago

#1487122 closed Bugs (fixed)

incorrect text attachment header

Reported by: antonaz Owned by:
Priority: 5 Milestone: 0.5-stable
Component: MIME parsing Version: 0.4.2
Severity: normal Keywords:
Cc:

Description (last modified by till)

Attached text files have incorrect Content-Type header.

--=_817a5bb9d752d5c746642685181a1ea8
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=iso-8859-1; charset=UTF-8;
 name=111110.TXT
Content-Disposition: attachment;
 filename=111110.TXT

MDAxMzRA....

Change History (14)

comment:1 Changed 3 years ago by till

  • Description modified (diff)

comment:2 Changed 3 years ago by till

I guess you're referring to the double charset?

Also, which is correct in your case? UTF-8?

comment:3 Changed 3 years ago by antonaz

I think 'default_charset' from config is right choice.

comment:4 Changed 3 years ago by alec

  • Milestone changed from later to 0.5-beta

The first charset is detected by PHP's fileinfo. The second is added by ROundcube. Question is: should we use detected charset, Roundcube charset, 'default_charset' or none?

comment:5 Changed 3 years ago by antonaz

Thunderbird dont set charset.

--------------020503090001050501040100
Content-Type: text/plain;
 name="111110.TXT"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="111110.TXT"

My problem is MS Outlook. Its convert file on save attachments.

comment:6 follow-up: Changed 3 years ago by till

I think we should keep the correct charset?

I mean, we don't convert files from utf-8 to iso8859-1(5), or anything when they are uploaded. So I guess the actual charset detected should be kept.

@antonaz: What do you mean, Outlook converts the file base on the charset? I think that could be avoided when the correct charset is used.

comment:7 follow-up: Changed 3 years ago by alec

It's not so simple. The charset is not always detected correctly. Also Roundcube uses defined charset for conversion to UTF-8 when displaying e.g. text or HTML attachments.

comment:8 in reply to: ↑ 7 Changed 3 years ago by till

Replying to alec:

It's not so simple. The charset is not always detected correctly. Also Roundcube uses defined charset for conversion to UTF-8 when displaying e.g. text or HTML attachments.

I think it is. Or rather, could be. If the charset is detected, add it, if not, don't add it. When I look at emails from Thunderbird, I don't seem to see it at all. What do you think?

comment:9 Changed 3 years ago by alec

I've said, detection is not perfect. For example a simple unicode text file is detected as unknown-8bit. When I send it with this charset specified, Roundcube displays broken characters.

comment:10 in reply to: ↑ 6 Changed 3 years ago by antonaz

Replying to till:

@antonaz: What do you mean, Outlook converts the file base on the charset? I think that could be avoided when the correct charset is used.

Original charset of my file is windows-1251 (not iso-8859-1(5), not utf-8). Recipient use Outlook and store file. Notepad show only ascii characters (other symbols is removed by Outlook).
Thunderbird show inline attachment with incorrect codepage, but save file correctly.

Charset detection is not usefull. Method precisely to detect the codepage doesn't exist. Especially on small files.

In my opinion, an error to specify charset.

comment:11 Changed 3 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [0f9d8ca4]. Attachment's charset is removed at all.

comment:12 Changed 2 years ago by antonaz

  • Resolution fixed deleted
  • Status changed from closed to reopened

Incorrect file name encoding after patching 0.4.2 version.

Content-Transfer-Encoding: base64
Content-Type: text/plain;
 name="=?US-ASCII?Q?=D1=82=D0=B5=D1=81=D1=82=2Etxt?="
Content-Disposition: attachment;
 filename*=US-ASCII''%D1%82%D0%B5%D1%81%D1%82.txt

comment:13 Changed 2 years ago by alec

A quick fix in [57388f9c]. We need a change in Mail_Mime package to set attachment charset and filename charset separately.

comment:14 Changed 2 years ago by alec

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in [53604a05].

Note: See TracTickets for help on using tickets.