javascript - encode parenthesis underscore tilt star with encodeURIComponent -
encodeuricomponent escapes characters except following: - _ . ! ~ * ' ( )
but possible extend functionality encode above special characters well.
i know can this:
encodeuricomponent(str).replace(/\(/g, "%28").replace(/\)/g, "%29"); but want functionality this, without using additional functions on encodeuricomponent
encodeuricomponent(str); you should create own function. you should create own function, really. if know you're doing, go step 1.
don't didn't warn you; there dragons here:
(function() { var _fn = encodeuricomponent; window.encodeuricomponent = function(str) { homecoming _fn(str).replace(/\(/g, "%28").replace(/\)/g, "%29"); }; }()); javascript encodeuricomponent
No comments:
Post a Comment