-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Can multipart parts have UTF-8 headers? #3876
Comments
I stumbled on this issue by chance. I believe the specification for to support encoding in header fields is RFC 8187. I'm not sure how iOS respects this specific RFC or not. But for me the answer to this question _ As I had to think about this thing server-side a couple years ago, here's what I remember with an update with the last RFCs : Historically RFC 2616 imposed characters of ISO/CEI 8859-1 (§2.2), but I believe the obsoleting RFCs 7230 changes that (in §3.2) for headers. However the new specification is still unclear about how to represent Unicode characters. Interestingly there is a specification that address this problem in RFC 5987 now obsoleted by RFC 8187 which find sources in email mime headers (RFC 2231):
It describes how to encode the fields of the headers, e.g. :
In the above case the Also for
But this RFC does not apply to this header appearing within a multipart/form-data body. For that you need to go to RFC 7578.
For reference §2 is what we saw above
From that I understand is that the
The RFC says these fields are part of a form and as such this information is usually hidden to the user, but this usually applies to web pages, application clients may indeed rely a bit more on those fields for the user experience. As a side note this may relate indirectly to #930 since OkHttp is updating to RFC 7230. |
Fixed with #4296 |
https://github.com/square/okhttp/blob/parent-3.12.0/okhttp/src/main/java/okhttp3/MultipartBody.java#L259 |
From a conversation on issue 2802, @megantracy93 has found that iOS & web clients permit UTF-8 characters in
content-disposition
headers.We might be able to do likewise, which will allow users to retain UTF-8 filenames when doing file uploads.
The text was updated successfully, but these errors were encountered: