I am developing an application in titanium using Javascript. I need an open source implementation of encodeURIComponent
in Javascript.
Can anybody guide me or show me some implementation?
I am developing an application in titanium using Javascript. I need an open source implementation of encodeURIComponent
in Javascript.
Can anybody guide me or show me some implementation?
What for do you need encodeuricomponent? It is already present in JS.
Anyway, here's an example of implementation:
http://phpjs.org/functions/rawurlencode:501#comment_93984
Here is my implementation:
The specification for this function is in 15.1.3.4.
Modern versions (2018) of V8 implement it in C++. See src/uri.h:
which calls into
Encode
defined in uri.cc.Older versions of V8 implemented it in JavaScript and distributed under the BSD license. See line 359 of src/uri.js.
It's not called
encodeURIComponent
there, but this code in the same file, esablishes the mapping: