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

net/textproto: ReadMIMEHeader returns invalid UTF8 in its error message #12715

Closed
signalsensefred opened this issue Sep 22, 2015 · 1 comment
Closed

Comments

@signalsensefred
Copy link

If ReadMIMEHeader returns an error because the MIME header is invalid, the string in that error contains the original MIME header, which can end up being invalid Unicode. The error string should be escaped, perhaps by formatting the MIME header as a list of byte values if utf8.ValidString returns false on it.

@ianlancetaylor ianlancetaylor changed the title textproto.ReadMIMEHeader() returns invalid UTF8 in its error message net/textproto: ReadMIMEHeader returns invalid UTF8 in its error message Sep 22, 2015
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Sep 22, 2015
@bradfitz
Copy link
Contributor

We can't possibly know the context in which you're rendering your errors. You also seem to confuse Unicode and UTF-8. I think it's up to the caller to properly render or propagate errors. We don't know the original encoding and I don't believe we have any existing precedent for promising UTF-8 error.String() values.

@golang golang locked and limited conversation to collaborators Sep 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants