-
Notifications
You must be signed in to change notification settings - Fork 18k
mime/quotedprintable: Unable to parse UTF-8 character in body #22597
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
Comments
Your forward quote is a multi-byte character and it must be qp-encoded. It is not. I think |
Thanks. It is indeed what one could expect from The only workaround I see for now is removing But IMO this flag should be in the stdlib, especially considering it doesn't seem blocking for any other parser/mail client/mail service. |
In the discussion of illegal substrings of quoted-printable data, RFC 2045 says:
So I suppose the question here is whether the mime/quotedprintable package should permit invalid bytes or not. Right now we return an error. One possibility would be:
That would maintain the current behavior for most callers, while permitting callers who want to permit invalid bytes to simply ignore the new exported error and carry on as though it did not occur. |
Per discussion with @bradfitz and @ianlancetaylor, let's just accept the >=0x80 bytes (for Go 1.11). CL welcome for Go 1.11. |
Change https://golang.org/cl/121095 mentions this issue: |
From the CL:
The harm is callers that could previously rely on stdlib to check the data was correct now can't. Callers that care have to now check for themselves before they pass the quoted-printable input downstream to non-stdlib that will barf. |
@RalphCorderoy It's certainly not ideal, but I think our priority has to be supporting the less sophisticated user. Since other systems are apparently doing the wrong thing, we need to support that. The different approach I outlined a few comments above seemed too complex. It's very simple for the sophisticated user to detect this problematic case by scanning the bytes returned from the |
What version of Go are you using (
go version
)?1.9.2
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux-amd64, happens as well on windows-amd64
What did you do?
I am parsing a Slack email using mime/multipart. It contains a special character "forward quote":
’
(not the regular simple quote)The following program reproduces the issue:
https://play.golang.org/p/jwZKGQ8fQS
What did you expect to see?
The message should be parsed properly and I should be able to get the part displayed in the log/output.
What did you see instead?
Failed to read all part: quotedprintable: invalid unescaped byte 0xe2 in body
The text was updated successfully, but these errors were encountered: