zoukankan      html  css  js  c++  java
  • Atitit.软件开发概念(11)网络子系统url编码 空格问题URLEncoder java js php

    Atitit.软件开发概念(11)--网络子系统--url编码 空格问题URLEncoder java js php 

    1. RFC2396标准

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

    在form的ContextType是[x-www-form-urlencoded]的时候会对form中的键/值对进行编码,空格被转义成+,其他字符按照[RFC1738]标准处理成%HH的形式。

    作者::老哇的爪子Attilax艾龙,EMAIL:1466519819@qq.com

    转载请注明来源: http://blog.csdn.net/attilax

    2. Js urlencode

    js对文字进行编码涉及3个函数:escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decodeURIComponent

    escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z

    encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z

    encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z

    3. 解决之道::

     s = org.tuckey.web.filters.urlrewrite.utils.URLEncoder.encodePathParam("a  b", "utf-8");//a%20%20b

    手动replace space to %20

    或者

    收到url解析时使用

    URLDecoder.decode("a++b%20c"));   //a  b c 

    4. 参考

    URL编码中的空格问题 - 来老师的专栏 - 博客频道 - CSDN.NET.htm

    js解码函数 escape,encodeURI,encodeURIComponent比较 - xuchanghao的专栏 - 博客频道 - CSDN.NET.htm

  • 相关阅读:
    Windows 10 字体替换
    Windows 任务栏增加秒显示
    CCProxy v8.0 代理服务器
    Git RPM软件包 && 源码包
    Google Chrome 浏览器最新版本 71.0.3578.98(正式版本) (64 位)
    Linux 查询公网出口IP
    Windows 10 Enterprise LTSC做Windows To Go蓝屏无法进入系统
    Nginx编译./configure翻译
    Windows 10 快捷键
    JDBC连接MySQL
  • 原文地址:https://www.cnblogs.com/attilax/p/15199070.html
Copyright © 2011-2022 走看看