Try it out:
encodeURIComponent(\"\'@#$%^&\");
If you try this out you will see all the special characters are encoded except for the single
I'm not sure why you would want them to be encoded. If you only want to escape single quotes, you could use .replace(/'/g, "%27")
. However, good references are: