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