@@ -6,14 +6,15 @@ function rawurlencode( str ) {
66 // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
77 // + input by: Michael Grier
88 // + bugfixed by: Brett Zamir (http://brett-zamir.me)
9+ // + input by: Ratheous
910 // * example 1: rawurlencode('Kevin van Zonneveld!');
1011 // * returns 1: 'Kevin%20van%20Zonneveld%21'
1112 // * example 2: rawurlencode('http://kevin.vanzonneveld.net/');
1213 // * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'
1314 // * example 3: rawurlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
1415 // * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'
1516
16- var histogram = { } , unicodeStr = '' , hexEscStr = '' ;
17+ var hash_map = { } , unicodeStr = '' , hexEscStr = '' ;
1718 var ret = str . toString ( ) ;
1819
1920 var replacer = function ( search , replace , str ) {
@@ -22,52 +23,52 @@ function rawurlencode( str ) {
2223 return tmp_arr . join ( replace ) ;
2324 } ;
2425
25- // The histogram is identical to the one in urldecode.
26- histogram [ "'" ] = '%27' ;
27- histogram [ '(' ] = '%28' ;
28- histogram [ ')' ] = '%29' ;
29- histogram [ '*' ] = '%2A' ;
30- histogram [ '~' ] = '%7E' ;
31- histogram [ '!' ] = '%21' ;
32- histogram [ '\u20AC' ] = '%80' ;
33- histogram [ '\u0081' ] = '%81' ;
34- histogram [ '\u201A' ] = '%82' ;
35- histogram [ '\u0192' ] = '%83' ;
36- histogram [ '\u201E' ] = '%84' ;
37- histogram [ '\u2026' ] = '%85' ;
38- histogram [ '\u2020' ] = '%86' ;
39- histogram [ '\u2021' ] = '%87' ;
40- histogram [ '\u02C6' ] = '%88' ;
41- histogram [ '\u2030' ] = '%89' ;
42- histogram [ '\u0160' ] = '%8A' ;
43- histogram [ '\u2039' ] = '%8B' ;
44- histogram [ '\u0152' ] = '%8C' ;
45- histogram [ '\u008D' ] = '%8D' ;
46- histogram [ '\u017D' ] = '%8E' ;
47- histogram [ '\u008F' ] = '%8F' ;
48- histogram [ '\u0090' ] = '%90' ;
49- histogram [ '\u2018' ] = '%91' ;
50- histogram [ '\u2019' ] = '%92' ;
51- histogram [ '\u201C' ] = '%93' ;
52- histogram [ '\u201D' ] = '%94' ;
53- histogram [ '\u2022' ] = '%95' ;
54- histogram [ '\u2013' ] = '%96' ;
55- histogram [ '\u2014' ] = '%97' ;
56- histogram [ '\u02DC' ] = '%98' ;
57- histogram [ '\u2122' ] = '%99' ;
58- histogram [ '\u0161' ] = '%9A' ;
59- histogram [ '\u203A' ] = '%9B' ;
60- histogram [ '\u0153' ] = '%9C' ;
61- histogram [ '\u009D' ] = '%9D' ;
62- histogram [ '\u017E' ] = '%9E' ;
63- histogram [ '\u0178' ] = '%9F' ;
26+ // The hash_map is identical to the one in urldecode.
27+ hash_map [ "'" ] = '%27' ;
28+ hash_map [ '(' ] = '%28' ;
29+ hash_map [ ')' ] = '%29' ;
30+ hash_map [ '*' ] = '%2A' ;
31+ hash_map [ '~' ] = '%7E' ;
32+ hash_map [ '!' ] = '%21' ;
33+ hash_map [ '\u20AC' ] = '%80' ;
34+ hash_map [ '\u0081' ] = '%81' ;
35+ hash_map [ '\u201A' ] = '%82' ;
36+ hash_map [ '\u0192' ] = '%83' ;
37+ hash_map [ '\u201E' ] = '%84' ;
38+ hash_map [ '\u2026' ] = '%85' ;
39+ hash_map [ '\u2020' ] = '%86' ;
40+ hash_map [ '\u2021' ] = '%87' ;
41+ hash_map [ '\u02C6' ] = '%88' ;
42+ hash_map [ '\u2030' ] = '%89' ;
43+ hash_map [ '\u0160' ] = '%8A' ;
44+ hash_map [ '\u2039' ] = '%8B' ;
45+ hash_map [ '\u0152' ] = '%8C' ;
46+ hash_map [ '\u008D' ] = '%8D' ;
47+ hash_map [ '\u017D' ] = '%8E' ;
48+ hash_map [ '\u008F' ] = '%8F' ;
49+ hash_map [ '\u0090' ] = '%90' ;
50+ hash_map [ '\u2018' ] = '%91' ;
51+ hash_map [ '\u2019' ] = '%92' ;
52+ hash_map [ '\u201C' ] = '%93' ;
53+ hash_map [ '\u201D' ] = '%94' ;
54+ hash_map [ '\u2022' ] = '%95' ;
55+ hash_map [ '\u2013' ] = '%96' ;
56+ hash_map [ '\u2014' ] = '%97' ;
57+ hash_map [ '\u02DC' ] = '%98' ;
58+ hash_map [ '\u2122' ] = '%99' ;
59+ hash_map [ '\u0161' ] = '%9A' ;
60+ hash_map [ '\u203A' ] = '%9B' ;
61+ hash_map [ '\u0153' ] = '%9C' ;
62+ hash_map [ '\u009D' ] = '%9D' ;
63+ hash_map [ '\u017E' ] = '%9E' ;
64+ hash_map [ '\u0178' ] = '%9F' ;
6465
6566
6667 // Begin with encodeURIComponent, which most resembles PHP's encoding functions
6768 ret = encodeURIComponent ( ret ) ;
6869
69- for ( unicodeStr in histogram ) {
70- hexEscStr = histogram [ unicodeStr ] ;
70+ for ( unicodeStr in hash_map ) {
71+ hexEscStr = hash_map [ unicodeStr ] ;
7172 ret = replacer ( unicodeStr , hexEscStr , ret ) ; // Custom replace. No regexing
7273 }
7374
0 commit comments