今天做项目构造链接参数的时候,推送到app上的链接点了没办法跳转到对应的界面
对比了一下能跳转的链接,原来是url没有加密,就推送过去了
在这里把对url加密解密的方法记录一下,方便以后使用
public static String getURLEncoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLEncoder.encode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}
public static String URLDecoderString(String str) {
String result = "";
if (null == str) {
return "";
}
try {
result = java.net.URLDecoder.decode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return result;
}