bin/uritemplate.js
function encodeCharacter (chr) {
        var
            result = '',
            octets = utf8.encode(chr),
            octet,
            index;
        for (index = 0; index < octets.length; index += 1) {
            octet = octets.charCodeAt(index);
            result += '%' + (octet < 0x10 ? '0' : '') + octet.toString(16).toUpperCase();
        }
        return result;
    }
function encodeCharacter (chr) {
        var
            result = '',
            octets = utf8.encode(chr),
            octet,
            index;
        for (index = 0; index < octets.length; index += 1) {
            octet = octets.charCodeAt(index);
            result += '%' + (octet < 0x10 ? '0' : '') + octet.toString(16).toUpperCase();
        }
        return result;
    }
function encodeCharacter ( chr ) { var result = '' , octets = utf8 . encode ( chr ) , octet , index ; for ( index = 0 ; index < octets . length ; index += 1 ) { octet = octets . charCodeAt ( index ) ; result += '%' + ( octet < 0x10 ? '0' : '' ) + octet . toString ( 16 ) . toUpperCase ( ) ; } return result ; }
encodes a character, if needed or not.
@param chr
@return pct-encoded character
encodes a character if needed or not .