Ticket #4624 (closed bug: fixed)
Charset in default ajaxSettings.contentType
| Reported by: | dimonnot | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.7.2 |
| Component: | ajax | Version: | 1.3.2 |
| Keywords: | ajax, charset, needsreview | Cc: | |
| Blocking: | Blocked by: |
Description
ajaxSettings.contentType must be "application/x-www-form-urlencoded; charset=UTF-8"
Change History
comment:2 Changed 3 years ago by dmethvin
- Status changed from new to closed
- Resolution set to worksforme
The default charset is UTF-8 for all XHR posts, so I don't think any action is required.
comment:3 Changed 2 years ago by castevinz@…
The default contentType of jquery doesn't mention the default charset.
In Firefox, the contentType is automatically updated with "application/x-www-form-urlencoded; charset=UTF-8", or in Google Chrome, the jquery default contentType is used, so "application/x-www-form-urlencoded" (look at the contentType in the request headers).
Although the default charset is UTF-8 for all XHR posts, why don't specify it to be cross-browser ?
comment:4 Changed 2 years ago by castevinz@…
Sorry, you could test it here : http://jsfiddle.net/vinzweb/H2LdJ/5/ If you change the "Charset encoding" of your browser in ISO-8859-1, you don't see the charset used in the contentType. So you have to refer to the field "X-Requested-With" (XMLHttpRequest) to be sure you are in UTF-8.
comment:5 Changed 18 months ago by rodrigo.rosenfeld
This should be fixed as I experienced real problems with the Chrome browser and a Tomcat server that uses ISO-8859-1 by default when the charset is not explicitly specified.
I'll open a new ticket pointing to this one since I can't reopen it here and no actual answer was given to why this was rejected.
comment:6 Changed 18 months ago by addyosmani
- Keywords charset, needsreview added; charset removed
- Status changed from closed to reopened
- Resolution worksforme deleted
- Milestone 1.4 deleted
comment:8 Changed 15 months ago by jaubourg
- Status changed from reopened to closed
- Resolution set to fixed
Fixes #4624... 3 years later, people!
Changeset: bd56456b1e886c7b03211212ac3c0a6a310b5cde
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Do you have a test case where this change is required? Also, are you asking that jQuery be changed to use that as the default content type?