I've been messing around with this for a while but I can't seem to get the right output basically I'm trying to make a js percentage encoder like the one that 2tap offers but URL encoding only encodes spaces. Here's what I've written so far:
const str = '4869937358'
let Hex = Buffer.from(str).toString('hex')
var i;
console.log(Hex)
var Ascii = ''
console.log(Hex.length)
for (i = 0; i < Hex.length; i++) {
Ascii = Ascii + ' ' + Hex.charCodeAt(i)
}
console.log(Ascii)
var chars = Ascii.split(' ');
var Hexed = ''
for (i = 0; i < chars.length; i++) {
Hexed = Hexed + hex.textToHex(chars[i])
}
Hexed = '%' + Hexed
var Fin = Hexed.replace(/(..?)/g, '$1%').slice(0,-1)
console.log(Fin)
Now I think there might be a way easier way to do this but since I'm not that good at JS I believe I took the hard way.