You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
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.
The text was updated successfully, but these errors were encountered: