File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,6 +116,8 @@ <h1><a href="https://github.com/medialize/URI.js">URI.js</a></h1>
116116
117117 < li > < a href ="#static-commonPath "> URI.commonPath()</ a > </ li >
118118 < li > < a href ="#static-withinString "> URI.withinString()</ a > </ li >
119+ < li > < a href ="#static-iso8859 "> URI.iso8859()</ a > </ li >
120+ < li > < a href ="#static-unicode "> URI.unicode()</ a > </ li >
119121 </ ul >
120122 </ li >
121123 </ ul >
@@ -757,6 +759,20 @@ <h3 id="static-withinString">URI.withinString()</h3>
757759 });
758760</ pre >
759761
762+ < h3 id ="static-iso8859 "> URI.iso8859()</ h3 >
763+ < p > URI.iso8859() tells URI.js to use the older escape/unescape methods, for backwards compatibility with older platforms.</ p >
764+ < pre class ="prettyprint lang-js "> URI.iso8859();
765+
766+ var uri = new URI("http://example.org/foo/æ.html");
767+ // http://example.org/foo/%E6.html</ pre >
768+
769+ < h3 id ="static-unicode "> URI.unicode()</ h3 >
770+ < p > URI.unicode() restores the default unicode-encoded URLs.</ p >
771+ < pre class ="prettyprint lang-js "> URI.unicode();
772+
773+ var uri = new URI("http://example.org/foo/æ.html");
774+ // http://example.org/foo/%C3%A6.html</ pre >
775+
760776 </ div >
761777</ body >
762- </ html >
778+ </ html >
Original file line number Diff line number Diff line change @@ -65,8 +65,18 @@ var URI = function(url, base) {
6565 }
6666
6767 return this ;
68- } ,
69- p = URI . prototype ;
68+ } ;
69+ var p = URI . prototype ;
70+
71+ URI . iso8859 = function ( ) {
72+ URI . encode = escape ;
73+ URI . decode = unescape ;
74+ }
75+
76+ URI . unicode = function ( ) {
77+ URI . encode = encodeURIComponent ;
78+ URI . decode = decodeURIComponent ;
79+ }
7080
7181// static properties
7282URI . idn_expression = / [ ^ a - z 0 - 9 \. - ] / i;
@@ -122,10 +132,10 @@ URI.characters = {
122132 }
123133} ;
124134URI . encodeQuery = function ( string ) {
125- return encodeURIComponent ( string + "" ) . replace ( / % 2 0 / g, '+' ) ;
135+ return URI . encode ( string + "" ) . replace ( / % 2 0 / g, '+' ) ;
126136} ;
127137URI . decodeQuery = function ( string ) {
128- return decodeURIComponent ( ( string + "" ) . replace ( / \+ / g, '%20' ) ) ;
138+ return URI . decode ( ( string + "" ) . replace ( / \+ / g, '%20' ) ) ;
129139} ;
130140URI . recodePath = function ( string ) {
131141 var segments = ( string + "" ) . split ( '/' ) ;
@@ -1260,4 +1270,4 @@ p.equals = function(uri) {
12601270
12611271window . URI = URI ;
12621272
1263- } ) ( ) ;
1273+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments