urlEncodeGBK.js

js纯代码实现gbk格式的url编码

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/427724/939166/urlEncodeGBKjs.js

Author
PYUDNG
Version
0.0.1.20210609184829
Created
2021-06-09
Updated
2021-06-09
License
N/A

urlEncodeGBK.js

js纯代码实现gbk格式的url编码

新增的全局方法:

encodeURI_GBKencodeURIComponent_GBK
encodeURIencodeURIComponent未改动,仍可使用

效果:

引用前:encodeURI('中文') >> "%E4%B8%AD%E6%96%87"
引用后:encodeURI_GBK('中文') >> "%D6%D0%CE%C4"

来源:http://www.vuln.cn/2901

相较于原代码,修改了函数名称,使原生encodeURIencodeURIComponent依然可用;将变量GBKTable声明为常量