Closed ZhaoTim closed 2 years ago
repeated \。
\
const encode = (str) => encodeURIComponent(str) .replace(/\\-/g, '%2D') .replace(/\\_/g, '%5F') .replace(/\\./g, '%2E') .replace(/\\!/g, '%21') .replace(/\\~/g, '%7E') .replace(/\\*/g, '%2A') .replace(/\\'/g, '%27') .replace(/\\(/g, '%28') .replace(/\\)/g, '%29'); console.log(encode('-');
After fix:
const encode = (str) => encodeURIComponent(str) .replace(/\-/g, '%2D') .replace(/\_/g, '%5F') .replace(/\./g, '%2E') .replace(/\!/g, '%21') .replace(/\~/g, '%7E') .replace(/\*/g, '%2A') .replace(/\'/g, '%27') .replace(/\(/g, '%28') .replace(/\)/g, '%29'); console.log(encode('-'));
Thank you, @ZhaoTim 👍
repeated
\
。After fix: