I have been trying to get an AJAX upload form working with the File
API recently introduced, but the uploaded files are corrupted. A quick
look in an hex editor have confirmed my suspicions about this being
charset error as the raw string from the binary file (zip file) is
turned into an utf8 string when it is decoded on the server.
I am not exactly sure where the error is but during my work i
attempted to override the headers sent by the AJAX.Request passing
this information in the options object:
"Content-Type": 'text/plain; charset=x-user-
I was expecting this to override the HTTP headers with the request,
but after some testing and debugging (using WebScarab) this works
apart from the Content-Type header. Using "Content-Type" concatenates
the specified input to the "Content-type" header field resulting in
the following "Content-type: application/x-www-form-urlencoded;
charset=UTF-8 text/plain; charset=UTF-8", note that my specified
charset is changed.
Correcting the key in my specified headers from "Content-Type" to
"Content-type" resolves this and correctly changes the type to "text/
plain", but the charset is still set to UTF-8. Is this intended
behavior or should it be reported as a bug?
Eirik Eggesbø Ottesen
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at