15.1.3.4 encodeURIComponent(uriComponent)

2010-07-03

string encodeURIComponent(uriComponent:string)

This function replaces certain characters by the UTF-8 encoded version of that character. Does not encode the hash (#).

Code: (Meta Ecma)
function encodeURIComponent(uriComponent){
var componentString = ToString(uriComponent);
var unescapedURISet = GetUriUnreservedCharacters() + '#'; // 15.1.3
return Encode(componentString, unescapedURISet); // 15.1.3.1
}