Atitit. Software Development Concepts (11)--Network subsystem--url coded whitespace urlencoder java js php

Source: Internet
Author: User

Atitit. Software Development Concepts (one)-- Network Subsystem --url encoding whitespace issues Urlencoder Java js PHP

1. RFC2396Standard

Including HTML 4.01 section 17.13.4, and also RFC 1866 (which is supercededby the website HTML recommendations).

When the contexttype of a form is [x-www-form-urlencoded], the key/value pairs in the form are encoded, the spaces are escaped to +, and the other characters are processed in%hh form according to the [RFC1738] standard.

Author:: Old Wow's paw attilax Ayron, email:[email protected]

Reprint please indicate source: Http://blog.csdn.net/attilax

2. Js UrlEncode

JS to encode the text involves 3 functions: Escape,encodeuri,encodeuricomponent, the corresponding 3 decoding function: unescape,decodeuri,decodeuricomponent

Escape does not encode characters with 69: *,+,-,.,/,@,_,0-9,a-z,a-z

encodeURI does not encode 82 characters:!,#,$,&, ', (,), *,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,a-z

encodeURIComponent does not encode 71 characters:!, ', (,), *,-,.,_,~,0-9,a-z,a-z

3. The solution::

 s =org.Tuckey.Web.Filters.Urlrewrite.Utils.Urlencoder.Encodepathparam("a B", "Utf-8");//a%20%20b

Manual Replace space to%20

Or

used when URL parsing is received

Urldecoder . Decode ("a++b%20c")) ; //a b c

4. Reference

Whitespace issues in URL encoding-come to the teacher's column-Blog channel-CSDN.NET.htm

JS decoding function Escape,encodeuri,encodeuricomponent comparison-Xuchanghao's column-Blog channel-CSDN.NET.htm

Atitit. Software Development Concepts (11)--Network subsystem--url coded whitespace urlencoder java js php

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.