package cn.aprilsoft.http;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
public class URIUtil {
public static String encodeURI(String encoding, String uri) {
try {
return URLEncoder.encode(uri, encoding);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
public static String decodeURI(String encoding, String uri) {
try {
return URLDecoder.decode(uri, encoding);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
}
|