Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read the charset of the attachment if given in the raw MIME #45

Closed
haggag opened this issue Nov 4, 2018 · 0 comments
Closed

Read the charset of the attachment if given in the raw MIME #45

haggag opened this issue Nov 4, 2018 · 0 comments
Assignees

Comments

@haggag
Copy link

haggag commented Nov 4, 2018

The problem
The charset property isn't read upon parsing MIME like the following snippet:

Content-Type: text/plain; charset="US-ASCII"; name="attachment1.txt"
Content-Disposition: attachment; filename="attachment1.txt"
Content-Transfer-Encoding: base64
Content-ID: <f_jnt7un642>
X-Attachment-Id: f_jnt7un642

MQ==
--000000000000d551e4057998ef2b
Content-Type: text/plain; charset="US-ASCII"; name="attachement2.txt"
Content-Disposition: attachment; filename="attachement2.txt"
Content-Transfer-Encoding: base64
Content-ID: <f_jnt7un5p1>
X-Attachment-Id: f_jnt7un5p1

Mg==

Note that the charset="US-ASCII" is set for both attachments above!

but mail-parser doesn't parse charset. For example the following is the output of parsing the above attachments without charset:

[
    {
        "filename": "attachment1.txt",
        "payload": "MQ==",
        "binary": true,
        "mail_content_type": "text/plain",
        "content-id": "<f_jnt7un642>",
        "content_transfer_encoding": "base64"
    },
    {
        "filename": "attachement2.txt",
        "payload": "Mg==",
        "binary": true,
        "mail_content_type": "text/plain",
        "content-id": "<f_jnt7un5p1>",
        "content_transfer_encoding": "base64"
    }
]

The proposed solution
The parsed attachments objects should contain the 'charset' field if given in the MIME data.

@fedelemantuano fedelemantuano self-assigned this Nov 5, 2018
fedelemantuano added a commit that referenced this issue Nov 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants