Bug 12099 - XMLHttpRequest shouldn't honor a charset specified via setRequestHeader
Summary: XMLHttpRequest shouldn't honor a charset specified via setRequestHeader
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-03 08:56 PST by Alexey Proskuryakov
Modified: 2007-01-08 12:06 PST (History)
0 users

See Also:


Attachments
proposed patch (4.50 KB, patch)
2007-01-08 02:50 PST, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2007-01-03 08:56:01 PST
Overriding Content-Type as 

req.setRequestHeader("Content-Type", "text/plain; charset='some-encoding'");
req.send(aString);

makes the sent string be encoded as "some-encoding" in WebKit, but not in MSIE or Firefox, where it's always sent as UTF-8. The XMLHttpRequest spec draft mandates IE/Firefox behavior, of course.

Additionally, looking at Content-Type further complicates the choice of encoding for documents, see bug 11695.
Comment 1 Alexey Proskuryakov 2007-01-08 02:50:19 PST
Created attachment 12298 [details]
proposed patch
Comment 2 Darin Adler 2007-01-08 10:12:10 PST
Comment on attachment 12298 [details]
proposed patch

r=me
Comment 3 Alexey Proskuryakov 2007-01-08 12:06:13 PST
Committed revision 18675.