当前位置: 首页 > news >正文

论文中引用网站怎么写内丘网站

论文中引用网站怎么写,内丘网站,欧派网站谁做的,有没有给人做简历的网站文章目录 1. 问题描述2. 原因2.1 编码2.2 解码 3. 解决方法 1. 问题描述 之前写了一个接口#xff0c;用 Apifox 请求#xff0c;参数传入一个 86 的电话#xff0c;结果到服务器 就变成空格了。 Java 接收请求的接口#xff1a; 2. 原因 2.1 编码 进行 URL 请求的… 文章目录 1. 问题描述2. 原因2.1 编码2.2 解码 3. 解决方法 1. 问题描述 之前写了一个接口用 Apifox 请求参数传入一个 86 的电话结果到服务器 就变成空格了。 Java 接收请求的接口 2. 原因 2.1 编码 进行 URL 请求的时候我们需要用 URLEncoder 对参数进行编码下面是编码的规则。 /*** Utility class for HTML form encoding. This class contains static methods* for converting a String to the CODEapplication/x-www-form-urlencoded/CODE MIME* format. For more information about HTML form encoding, consult the HTML* A HREFhttp://www.w3.org/TR/html4/specification/A.** p* When encoding a String, the following rules apply:** ul* liThe alphanumeric characters quot;{code a}quot; through* quot;{code z}quot;, quot;{code A}quot; through* quot;{code Z}quot; and quot;{code 0}quot;* through quot;{code 9}quot; remain the same.* liThe special characters quot;{code .}quot;,* quot;{code -}quot;, quot;{code *}quot;, and* quot;{code _}quot; remain the same.* liThe space character quot; nbsp; quot; is* converted into a plus sign quot;{code }quot;.* liAll other characters are unsafe and are first converted into* one or more bytes using some encoding scheme. Then each byte is* represented by the 3-character string* quot;i{code %xy}/iquot;, where ixy/i is the* two-digit hexadecimal representation of the byte.* The recommended encoding scheme to use is UTF-8. However,* for compatibility reasons, if an encoding is not specified,* then the default encoding of the platform is used.* /ul** p* For example using UTF-8 as the encoding scheme the string quot;The* string #252;foo-barquot; would get converted to* quot;Thestring%C3%BC%40foo-barquot; because in UTF-8 the character* #252; is encoded as two bytes C3 (hex) and BC (hex), and the* character is encoded as one byte 40 (hex).** author Herb Jellinek* since JDK1.0*/ public class URLEncoder {... }直接上 GPT解释如下 保留字符 字母a-z, A-Z和数字0-9保持不变。特殊字符 .点、-减号、*星号和 _下划线保持不变。 空格 空格字符 被转换为加号。 其他字符 所有其他字符被认为是“不安全的”需要先使用某种编码方案如UTF-8转换为一个或多个字节然后每个字节表示为%xy其中xy是该字节的十六进制表示。 举个例子假设使用UTF-8编码字符串 “The string üfoo-bar” 将被转换为 “Thestring%C3%BC%40foo-bar”因为 字符 ü 在UTF-8中编码为两个字节 C3 和 BC。 字符 编码为一个字节 40。 2.2 解码 编码之后就能发送请求到服务器了而我们直接在 Postman 上面请求的 URL 如下 可以理解成编码之后的 URL所以接收请求的时候同样会进行 URL 解码。那么 URL 是如何解码的呢我们可以同样到 URLDecoder 里面去找答案 /*** Utility class for HTML form decoding. This class contains static methods* for decoding a String from the CODEapplication/x-www-form-urlencoded/CODE* MIME format.* p* The conversion process is the reverse of that used by the URLEncoder class. It is assumed* that all characters in the encoded string are one of the following:* quot;{code a}quot; through quot;{code z}quot;,* quot;{code A}quot; through quot;{code Z}quot;,* quot;{code 0}quot; through quot;{code 9}quot;, and* quot;{code -}quot;, quot;{code _}quot;,* quot;{code .}quot;, and quot;{code *}quot;. The* character quot;{code %}quot; is allowed but is interpreted* as the start of a special escaped sequence.* p* The following rules are applied in the conversion:** ul* liThe alphanumeric characters quot;{code a}quot; through* quot;{code z}quot;, quot;{code A}quot; through* quot;{code Z}quot; and quot;{code 0}quot;* through quot;{code 9}quot; remain the same.* liThe special characters quot;{code .}quot;,* quot;{code -}quot;, quot;{code *}quot;, and* quot;{code _}quot; remain the same.* liThe plus sign quot;{code }quot; is converted into a* space character quot; nbsp; quot; .* liA sequence of the form i{code %xy}/i will be* treated as representing a byte where ixy/i is the two-digit* hexadecimal representation of the 8 bits. Then, all substrings* that contain one or more of these byte sequences consecutively* will be replaced by the character(s) whose encoding would result* in those consecutive bytes.* The encoding scheme used to decode these characters may be specified,* or if unspecified, the default encoding of the platform will be used.* /ul* p* There are two possible ways in which this decoder could deal with* illegal strings. It could either leave illegal characters alone or* it could throw an {link java.lang.IllegalArgumentException}.* Which approach the decoder takes is left to the* implementation.** author Mark Chamness* author Michael McCloskey* since 1.2*/public class URLDecoder {... }还是一样直接用 GPT 解释 **字母和数字**字母a到z、A到Z和数字0到9保持不变。**特殊字符**点号.、连字符-、星号*和下划线_保持不变。**加号**加号被转换为空格字符。**百分号编码**形式为%xy的序列被视为表示一个字节其中xy是该字节的两位十六进制表示。连续的这些字节序列将被替换为那些字节所表示的字符。字符的编码方案可以指定如果没有指定则使用平台的默认编码。 比如请求参数http://localhost:8080/demo/getName?name.-*_aA0%2B 服务端这边的接收.-*_aA0 可以看到 号解码成空格同时 %2B 解码成 号了。因为 的 Ascii 十六进制就是 2B。 3. 解决方法 既然 号是被解码成空格了那我们可以不把 号放在 URL 中可以放在 Body 中也就是使用 Post 请求把参数放到请求体中传入就不会解码了。 RequestMapping(/demo) RestController public class DemoController {GetMapping(getName)public void reqDemo(RequestBody DataDemo dataDemo){System.out.println(dataDemo.getName());} }Getter Setter public class DataDemo {private String name; }输出结果如下 此外还有一种方法就是上面说的传入 %2B 就行了。 如有错误欢迎指出
http://www.dnsts.com.cn/news/225737.html

相关文章:

  • 微信网站前景2017还有人做网站吗
  • 东莞网站建设都找菲凡网络软件工程要学什么
  • 湛江百度网站快速排名高新西区网站建设
  • 安徽中色十二冶金建设有限公司网站用html制作个人网页
  • 启动网站建设的请示竞网做的网站怎么样
  • 自助服务系统网站南昌做网站公司
  • 网站设计网页版中山网站建设金科
  • 网站重新搭建程序要多少钱网络教育做的好的网站
  • 做外贸网站推广铁汉生态建设有限公司网站
  • 网站建设与网站优化wordpress主题logo
  • 深圳市国外网站建设服务机构南充免费推广网站
  • 广东微信网站建设价格学好seo
  • 网站制作网站优化网络营销推广的具体做法
  • 网站建设的话术青海省电话黄页
  • 网站建设和技术服务合同范本网站地图代码
  • 网站开发有什么好的论坛群站优化之链轮模式
  • 知乐商城是什么网站百度如何建网站
  • 制作网站的工具装修公司哪家好广州市
  • wordpress网站调用导航菜单专科网站开发就业方向
  • 做面料哪个网站好缩我短网址生成
  • seo网站优化价格wordpress微信验证码登录
  • 企业为啥要做网站食品网站的建设背景
  • 网文网站网站对联广告html代码
  • 法治建设网站模块名称南宁网站建设公司招聘
  • 创建asp.net网站山西住房城乡建设部网站
  • 网站备案的接入商佛山网站搭建公司哪家好
  • 昆明做网站找启搜网络建站宝盒哪个牌子好
  • 如何修改一个网站的后台登陆系统常州手机网站制作
  • 怎么创建免费网站拼多多推广引流软件免费
  • 邯郸网站建设纵横专注网站开发