【发布时间】:2021-07-25 11:40:52
【问题描述】:
在 JavaScript 中,我想使用 encodeURIComponent(),但输出是大写的。
console.log(encodeURIComponent("[Abcd123]"));
//returns %5BAbcd123%5D
我想要一个小写的结果,比如
%5bAbcd123%5d
有可能吗?
【问题讨论】:
-
你为什么要那个?你希望达到什么目标?
-
字符串上的 .toLowerCase() 怎么样
-
@AtanasB - 这会将未编码的
A更改为a,这是他们似乎不想要的。 -
@AlaksandarJesusGene - 不,百分比编码的十六进制数字不区分大小写。
-
@AlaksandarJesusGene 不难查:
console.log(unescape("%5b"), decodeURI("%5b"))
标签: javascript jquery encodeuricomponent