-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Issue with saving XML attachments #228
Comments
Hi, BOM always generated errors in most softwares and the modern pratice is to create UTF-8 documents without it. Still, if the BOM is there, you need to handle it by yourself: the decoding of the attachment of this library is correct. |
Ok it worked in version 0.5.2 |
I don't understand your last message: did it behave different in 0.5.2? By the way the base64 encoding of the BOM is |
Well I switched today to version 1 of this library, and now I have this issue... It worked last night correctly... |
If you can provide me the full raw message with sensitive informations obscured I will be happy to inspect the change and publish the eventual fix. |
Should an XML attachment be passed to Transcoder::decode ? I think this is the problem? https://github.com/ddeboer/imap/blob/master/src/Message/AbstractPart.php#L280 |
An attachment never needs a charset decoding, since it's (almost) always sent encoded in Base64. I'm sorry but I can't help you without the original mail that is causing the output you consider errored. |
Yeah so I think an XML attachment will have a type of TEXT, and that is passed to the transcoder, if the mail was sent with I can't send you the email because it is very sensitive to our business... This works for me now:
|
I was wrong: encoded attachment are charset-decoded if they are a text type like an XML. The issue is that we consider the default server charset as us-ascii. Previous version did some guessing and in your case found the right charset: this is not an acceptable behaviour anymore because it's very brittle. I need to do further investigation (in the next days). |
Thanks for the help! I now have a quick "fix" for my issue, for now it works for me... I will keep a close eye on this! Thanks again! |
I have bad news about this issue.
An example: two XML files with the same content composed by charset-specific chars like If we compose the email in Thunderbird 52 with both the attachments, the receiver gets:
You can see that in the Gmail is smarter: it tries to detect the charset of the attachment and declare it:
After receiving this email, we can safely charset-decode both attachment the right way. The fix I pushed in #227 introduce the default behaviour of the most email clients. At the time of writing I don't see a robust solution to this issue 🙍 |
Ok thanks for the explanation... I will have to create a workaround for my tool... |
Version: 1.0.1
I had an error after issue #226, seems to be related to encoding with "us-ascii"
@Slamdunk These are my email headers btw
When saving the attachment, it seems the encoding is screwed of the XML file... The PDF seems correct...
The text was updated successfully, but these errors were encountered: