106 |
public static String decode(String s, String encoding) |
public static String decode(String s, String encoding) |
107 |
throws UnsupportedEncodingException |
throws UnsupportedEncodingException |
108 |
{ |
{ |
|
StringBuffer result = new StringBuffer(); |
|
|
|
|
109 |
// First convert all '+' characters to spaces. |
// First convert all '+' characters to spaces. |
110 |
String str = s.replace('+', ' '); |
String str = s.replace('+', ' '); |
111 |
|
|
114 |
int start = 0; |
int start = 0; |
115 |
byte[] bytes = null; |
byte[] bytes = null; |
116 |
int length = str.length(); |
int length = str.length(); |
117 |
|
StringBuffer result = new StringBuffer(length); |
118 |
while ((i = str.indexOf('%', start)) >= 0) |
while ((i = str.indexOf('%', start)) >= 0) |
119 |
{ |
{ |
120 |
// Add all non-encoded characters to the result buffer |
// Add all non-encoded characters to the result buffer |