mozilla

Compare Revisions

encodeURIComponent()

Change Revisions

Revision 26192:

Revision 26192 by ziyunfei on

Revision 317397:

Revision 317397 by rodneyrehm on

Title:
encodeURIComponent
encodeURIComponent
Slug:
JavaScript/Reference/Global_Objects/encodeURIComponent
JavaScript/Reference/Global_Objects/encodeURIComponent
Content:

Revision 26192
Revision 317397
n67      For application/x-www-form-urlencoded&nbsp; (POST), per <a n67      For application/x-www-form-urlencoded&nbsp; (POST), per <a 
>class=" external" href="http://www.w3.org/TR/html401/interact/for>class="external" href="http://www.w3.org/TR/html401/interact/form
>ms.html#form-content-type" rel="freelink">http://www.w3.org/TR/ht>s.html#form-content-type" rel="freelink">http://www.w3.org/TR/htm
>ml401/interac...m-content-type</a>, spaces are to be replaced by >l401/interac...m-content-type</a>, spaces are to be replaced by '
>'+', so one may wish to follow a encodeURIComponent replacement w>+', so one may wish to follow a encodeURIComponent replacement wi
>ith an additional replacement of "%20" with "+".>th an additional replacement of "%20" with "+".
n70      If one wishes to be more stringent in adhering to <a class=n70      If one wishes to be more stringent in adhering to <a class=
>"external" href="http://labs.apache.org/webarch/uri/rfc/rfc3986.h>"external" href="http://tools.ietf.org/html/rfc3986" title="http:
>tml" title="http://labs.apache.org/webarch/uri/rfc/rfc3986.html">>//labs.apache.org/webarch/uri/rfc/rfc3986.html">RFC 3986</a> (whi
>RFC 3986</a> (which reserves !, ', (, ), and *), even though thes>ch reserves !, ', (, ), and *), even though these characters have
>e characters have no formalized URI delimiting uses, the followin> no formalized URI delimiting uses, the following can be safely u
>g can be safely used:>sed:
t74  return encodeURIComponent(str).replace(/[!'()*]/g, escape);t74  return encodeURIComponent(str).replace(/[!'()]/g, escape).repla
 >ce(/\*/g, "%2A");

Back to History