The answer to your question: None . You cannot change it. According to XMLHttpRequest2 TR , FormData constructed data is explicitly encoded to UTF-8 . Without mentioning the possibility of changing it.
Regular mimeType or Content-Type = charset become invalid for multipart requests, because for the same reason it is handled differently.
To quote
If the data is FormData Let the body of the request object be the result of running the multipart / form-data encoding algorithm with data in the form of a form data set and with UTF-8 as explicit character encoding .
Let the mime type be the concatenation of "multipart / form-data;", the character SP + SPO U + 0020, "border =" and the border line multipart / form-data generated by the multipart / form-data encoding algorithm.
Hope this helps!
Update
If you are willing to give up
new FormData(document.forms.namedItem("fileinfo"));
for
new FormData().append("name", "value")
possible solution. Let me know if this is what you are looking for.
Another update
I ran a little. Updated violin with all modes
So this is the story
1 form with accept-charset="utf8" => default behavior
Content does not require additional screening / coding. Thus, the request is triggered with the text without changes as für løbende
2 form with accept-charset="windows-1251" => your case
The content requires additional escaping / encoding, since utf8 is used in the default encoding of the browser. Thus, the content is escaped and then launched, that is, the sent content is får løbende
3 FormData constructed with form element
The content does not require additional escaping / encoding, since by default it is equal to utf8 . Thus, the query is triggered with text as für løbende .
4 FormData constructed, and then appended with escaped data
The content is still in utf8 encoding, but you do not need to call escape(content) before adding to the form data. This means that the request is triggered with text as f%E5r%20l%F8bende . Still no bone?
I was mistaken, no. Having looked closely [read => looking for several minutes ....] on
får løbende and
f%E5r%20l%F8bende
Then it all fell into place - %E5 (hexadecimal) = å (decimal). So basically escape() is a Javascript way of doing things based on % encoding that doesn't support HTML.
Similar to &#; , as we know, is an HTML coding method. So I add another mode in ajax, [this is what you are looking for, I assume]
5 FormData constructed, and then appended with html-escaped data
The content is still in utf8 encoding. It doesn't hurt to avoid it, like HTML coding, using this wonderful piece of code from fooobar.com/questions/21554 / .... And voila, the request was launched with the text får løbende
Updated violin with all modes
Hope this helps sort it out!
UPDATE for full support for Windows-1251
This input für løbende did not work in earlier mode. 5. Update the script http://jsfiddle.net/epsSZ/6/ .
Uses a combination of solutions here fooobar.com/questions/964706 / ... and mine. Therefore, the problem is to avoid everything. So, now we only avoid characters that are not encoded in windows-1251.
It helps me hope!