There is a r20 regular expression in jQuery's serialize module
var r20 = / /g,
The jQuery.param method will convert all " " into " ", that is, before submitting the data, if the data contains spaces, after passing through encodeURIComponent, the spaces will be converted into " "
encodeURIComponent(' ') === ' '; // true
Finally, you need to convert " " to "=" before Post submission. In this way, what the background program receives is the real space.
For encodeURIComponent, see MDC description
encodeURIComponent escapes all characters except the following: alphabetic, decimal digits, - _ . ! ~ * ' ( )
To avoid unexpected requests to the server, you should call encodeURIComponent on any user-entered parameters that will be passed as part of a URI. For example, a user could type "Thyme &time=again" for a variable comment. Not using encodeURIComponent on this variable will give comment=Thyme &time=again. Note that the ampersand and the equal sign mark a new key and value pair. So instead of having a POST comment key equal to "Thyme &time=again", you have two POST keys, one equal to "Thyme " and another (time) equal to again.
For application/x-www-form-urlencoded (POST), per http://www.w3.org/TR/ html401/interac...m-content-type, spaces are to be replaced by ' ', so one may wish to follow a encodeURIComponent replacement with an additional replacement of " " with " ".
Related :
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent
http://www.w3.org/TR/html401/interact/ forms.html#form-content-type