import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
/**
* URL处理工具
* @author RuiLin.Xie - xKF24276
*
*/
public class UrlUtil
{
/**
* URL编码
* @param url
* @return
*/
public static String encode(String url, String enc)
{
String s = null;;
try
{
s = URLEncoder.encode(url, enc);
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
return s;
}
/**
* URL解码
* @param url
* @return
*/
public static String decode(String url, String enc)
{
String s = null;
try
{
s = URLDecoder.decode(url, enc);
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
return s;
}
}
URL编码解码
最新推荐文章于 2024-09-25 18:18:48 发布