Bug Tracker


Ticket #4624 (closed bug: fixed)

Opened 5 years ago

Last modified 2 years ago

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:


ajaxSettings.contentType must be "application/x-www-form-urlencoded; charset=UTF-8"

Change History

comment:1 Changed 5 years ago by dmethvin

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?

comment:2 Changed 4 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 3 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 3 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 2 years 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 2 years ago by addyosmani

  • Keywords charset, needsreview added; charset removed
  • Status changed from closed to reopened
  • Resolution worksforme deleted
  • Milestone 1.4 deleted

comment:7 Changed 2 years ago by addyosmani

#10953 is a duplicate of this ticket.

comment:8 Changed 2 years ago by jaubourg

  • Status changed from reopened to closed
  • Resolution set to fixed

Fixes #4624... 3 years later, people!

Changeset: bd56456b1e886c7b03211212ac3c0a6a310b5cde

comment:9 Changed 2 years ago by jaubourg

  • Milestone set to 1.7.2

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.