当前位置:网站首页>替换URL中的特殊字符(%E2%80%8B)
替换URL中的特殊字符(%E2%80%8B)
2022-07-17 00:05:00 【Sunshine_Jian】
一、场景:
在复制后端接口文档的时候,调用时直接报404错误,查看请求的时候,发现有特殊字符出现,
经排查url,发现其中有特殊字符,且肉眼无法识别。
具体表现:鼠标光标在慢慢向后移动时,会在特殊字符那里停顿一下;
错误示例:/api/menu/goodsList/
二、 %E2%80%8B
1、英文名: Zero-width-space
2、中文名: 零宽空格
3、Unicode
三、解决办法:
1、delete
找到特殊字符的位置,直接删除;
2、将 特殊字符 替换 为 ‘’
// 请求拦截器
axios.interceptors.request.use(
config => {
// 先把config.url进行URI编码,然后全局替换其中的特殊字符,然后再URI解码
config.url = decodeURI(encodeURI(config.url).replace(/%E2%80%8B/g, ''))
return config
},
error => {
console.log(error)
return Promise.reject(error)
}
)边栏推荐
猜你喜欢
随机推荐
智能指针(shared_ptr、unique_ptr、weak_ptr)
Buuctf [bjdctf2020]ezphp1 detailed explanation
uni canvas截取图片
Gateway Kong route adding instructions
Supplementary knowledge of attributes and methods of regular, JWT token, ronglianyun, celery, channel group, SKU, SPU, request object
js替换字符串某个字符,js修改字符串中指定字符
深度之眼三——(7)】数学:svd分解的应用
uniapp中text-indent不起作用,uniapp首行缩进不管用如何解决?
mmap的 Bus error问题及解决
分布式之数据库和缓存双写一致性方案解析(转载)
深度之眼三——(4,5)】数学:矩阵特征值与特征向量2
pytorch index_ select
物联网开发基础
From catf1ag two-hour AK match pwn/attack killing, summarize the common command guide of emergency response
Maker-鸿蒙应用开发培训笔记03
[GFCTF 2021]Baby_ Cve-2021-41773 on the web
使用bat自动执行cmd命令(多个命令或单个命令)
C Programming Language(2nd Edition)--读书笔记--1.5
E-commerce background management login
初始Flask


![Eye of depth III - (7)] mathematics: application of SVD decomposition](/img/18/f69d012ebadf2c7aedfbea40ae1cf5.png)






