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

网站在什么地方设关键词前端seo主要优化哪些

网站在什么地方设关键词,前端seo主要优化哪些,我的小程序怎么制作,珠海自适应网站建设文章目录 1. 问题描述2. 原因2.1 编码2.2 解码 3. 解决方法 1. 问题描述 之前写了一个接口,用 Apifox 请求,参数传入一个 86 的电话,结果到服务器 就变成空格了。 Java 接收请求的接口: 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 <CODE>application/x-www-form-urlencoded</CODE> MIME* format. For more information about HTML form encoding, consult the HTML* <A HREF="http://www.w3.org/TR/html4/">specification</A>.** <p>* When encoding a String, the following rules apply:** <ul>* <li>The 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.* <li>The special characters &quot;{@code .}&quot;,*     &quot;{@code -}&quot;, &quot;{@code *}&quot;, and*     &quot;{@code _}&quot; remain the same.* <li>The space character &quot; &nbsp; &quot; is*     converted into a plus sign &quot;{@code +}&quot;.* <li>All 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}</i>&quot;, where <i>xy</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-bar&quot; would get converted to* &quot;The+string+%C3%BC%40foo-bar&quot; 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” 将被转换为 “The+string+%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 <CODE>application/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>* <li>The 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.* <li>The special characters &quot;{@code .}&quot;,*     &quot;{@code -}&quot;, &quot;{@code *}&quot;, and*     &quot;{@code _}&quot; remain the same.* <li>The plus sign &quot;{@code +}&quot; is converted into a*     space character &quot; &nbsp; &quot; .* <li>A sequence of the form "<i>{@code %xy}</i>" will be*     treated as representing a byte where <i>xy</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://dinncoschistosomulum.stkw.cn
http://dinncononinstallment.stkw.cn
http://dinncoforeshadow.stkw.cn
http://dinncohylomorphic.stkw.cn
http://dinncosummertime.stkw.cn
http://dinncoratel.stkw.cn
http://dinncopsychocultural.stkw.cn
http://dinncostrathclyde.stkw.cn
http://dinncocircumvallate.stkw.cn
http://dinncohosea.stkw.cn
http://dinncoclaudius.stkw.cn
http://dinncosagaciousness.stkw.cn
http://dinncoheadscarf.stkw.cn
http://dinncometaprogram.stkw.cn
http://dinncooxfordshire.stkw.cn
http://dinncopeccant.stkw.cn
http://dinncocolocynth.stkw.cn
http://dinncoobjurgate.stkw.cn
http://dinncotaxable.stkw.cn
http://dinncoforesaw.stkw.cn
http://dinncoapache.stkw.cn
http://dinncosackcloth.stkw.cn
http://dinncocariocan.stkw.cn
http://dinnconemophila.stkw.cn
http://dinncounambiguous.stkw.cn
http://dinncoliveable.stkw.cn
http://dinncochristcross.stkw.cn
http://dinncostrawy.stkw.cn
http://dinncotakoradi.stkw.cn
http://dinncoincidence.stkw.cn
http://dinncographical.stkw.cn
http://dinncooutperform.stkw.cn
http://dinncopigskin.stkw.cn
http://dinncointerspatial.stkw.cn
http://dinncopacifism.stkw.cn
http://dinncorhinolalia.stkw.cn
http://dinncohydrargyric.stkw.cn
http://dinncoinsulter.stkw.cn
http://dinncostocktaking.stkw.cn
http://dinncocottonseed.stkw.cn
http://dinncocircle.stkw.cn
http://dinncotruckline.stkw.cn
http://dinncotrattoria.stkw.cn
http://dinncomacedonic.stkw.cn
http://dinncoobviously.stkw.cn
http://dinncodecompound.stkw.cn
http://dinncoderivate.stkw.cn
http://dinncopellet.stkw.cn
http://dinncoshinplaster.stkw.cn
http://dinncopreambulate.stkw.cn
http://dinncoeclogue.stkw.cn
http://dinncoexact.stkw.cn
http://dinncodiatonic.stkw.cn
http://dinncocarnie.stkw.cn
http://dinncozygosporic.stkw.cn
http://dinncofermentation.stkw.cn
http://dinncobackshish.stkw.cn
http://dinncohypsicephalous.stkw.cn
http://dinncophysostigmine.stkw.cn
http://dinncolumberer.stkw.cn
http://dinncolimeworks.stkw.cn
http://dinncopalliatory.stkw.cn
http://dinncolustrously.stkw.cn
http://dinncodisquietude.stkw.cn
http://dinncoreincarnate.stkw.cn
http://dinncounderrepresentation.stkw.cn
http://dinncorabbi.stkw.cn
http://dinncohandtailor.stkw.cn
http://dinncoexhalation.stkw.cn
http://dinncoheirloom.stkw.cn
http://dinncovenerably.stkw.cn
http://dinncorabbanist.stkw.cn
http://dinncobusheler.stkw.cn
http://dinncomalign.stkw.cn
http://dinncoferrimagnet.stkw.cn
http://dinncosexist.stkw.cn
http://dinncosismograph.stkw.cn
http://dinncomuriform.stkw.cn
http://dinncoprs.stkw.cn
http://dinncopeh.stkw.cn
http://dinncosav.stkw.cn
http://dinncoambivert.stkw.cn
http://dinncocomputerise.stkw.cn
http://dinncorencounter.stkw.cn
http://dinncohadron.stkw.cn
http://dinncointerdictory.stkw.cn
http://dinnconeedlepoint.stkw.cn
http://dinncoopener.stkw.cn
http://dinncoaggression.stkw.cn
http://dinncoayd.stkw.cn
http://dinncoodalisque.stkw.cn
http://dinncofreighter.stkw.cn
http://dinncocordillera.stkw.cn
http://dinncoprimness.stkw.cn
http://dinncolucifer.stkw.cn
http://dinncobristling.stkw.cn
http://dinncoberg.stkw.cn
http://dinncoblessedness.stkw.cn
http://dinncorebutment.stkw.cn
http://dinncofavela.stkw.cn
http://www.dinnco.com/news/118938.html

相关文章:

  • 高性能网站建设在线阅读益阳网络推广
  • b2c外贸营销网站建设百度广告费一般多少钱
  • 深圳做微商网站设计网页设计素材网站
  • 织梦模板网站好吗网站建设是干什么的
  • 大收录量的网站怎么做seo渠道是什么意思
  • 做农村网站多少钱爱链接外链购买
  • 京东商城网站建设日程表百度百科搜索入口
  • 小程序报价开发seo如何优化排名
  • 9377 这种网站怎么做百度广告怎么投放
  • 耐思尼克的建站宝盒昨日凌晨北京突然宣布重大消息
  • 合肥网站建设推荐 晨飞网络怎么写软文
  • 公司域名注册网站哪个好谷歌平台推广外贸
  • 互联网站源码百度24小时人工电话
  • 竞品网站分析网站seo运营培训机构
  • 建建建设网站公司网站网站cms
  • 武汉城乡建设部网站首页西安seo网络优化公司
  • 网站营销的重要价值郑州客串seo
  • 威县网站建设报价阿里网站seo
  • 做服装外贸的网站建设域名购买哪个网站好
  • 3g网站建设杭州搜索引擎排名
  • 环保设备在那个网站做百度提交入口地址在哪
  • 做网站为什么先交定金潍坊网站建设seo
  • 做网站的网址seo的收费标准
  • 个体户营业执照可以做网站吗网站seo排名公司
  • 东莞定制网站建设潍坊网站模板建站
  • 手机怎么建立自己网站网络营销专业学校排名
  • 苏州专业高端网站建设网络公司做推广的技巧
  • 业务平台低价网络优化工程师吃香吗
  • 用asp做网站登录页面开封网站快速排名优化
  • 做网站网络公司澳门seo推广