Closed
Bug 669239
Opened 13 years ago
Closed 13 years ago
Wrong filename encoding when submitting form using FormData
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: wfernandom2004, Unassigned)
Details
For instance: <HTML> ... <META http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'> ... <FORM enctype="multipart/form-data" method=post> <input type='file'> </FORM> </HTML If a file name with latin characters, for instance "ação.jpg", is going to be uploaded and document.forms[0].submit() is used then everything works well. However using "new XHR().send(new FormData(document.forms[0]))" the file's name is sent using the UTF-8 charset. I couldn't find how to fix the charset...
Comment 1•13 years ago
|
||
The XHR2 spec draft says (at http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#the-send-method ): If data is a FormData Let the request entity body be the result of running the multipart/form-data encoding algorithm with data as form data set and with UTF-8 as the explicit character encoding. The multipart/form-data encoding algorithm is at http://www.whatwg.org/specs/web-apps/current-work/multipage/#multipart/form-data-encoding-algorithm and says (step 2): If the algorithm was invoked with an explicit character encoding, let the selected character encoding be that encoding. and (step 5): File names included in the generated multipart/form-data resource (as part of file fields) must use the character encoding selected above. So it looks like the behavior you're seeing is exactly what the XMLHttpRequest spec draft calls for.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Updated•13 years ago
|
Component: File Handling → DOM
QA Contact: file-handling → general
Reporter | ||
Comment 2•13 years ago
|
||
Humm, actually the encoding algorithm is correct. However I don't agree with the spec. Since the FormData is created upon a html form which when submitted uses another encoding then xhr.send(FormData) should do the same as well.
Comment 3•13 years ago
|
||
That seems like a reasonable complaint to take up with the spec, yes. Please file a bug on the spec? I agree that in the case when the formdata is created from a form it would make sense to carry along the charset information from the form and expose it on formdata somehow and make XHR use it.
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•