2020-11-12 21:19:45 +00:00
|
|
|
package me.kavin.piped.utils;
|
|
|
|
|
2021-03-04 14:14:52 +00:00
|
|
|
import java.net.URLDecoder;
|
2020-11-12 21:19:45 +00:00
|
|
|
import java.net.URLEncoder;
|
|
|
|
|
|
|
|
public class URLUtils {
|
|
|
|
|
|
|
|
public static String silentEncode(String s) {
|
2021-02-24 09:52:29 +00:00
|
|
|
try {
|
|
|
|
return URLEncoder.encode(s, "UTF-8");
|
|
|
|
} catch (Exception e) {
|
|
|
|
// ignored
|
|
|
|
}
|
|
|
|
return s;
|
2020-11-12 21:19:45 +00:00
|
|
|
}
|
2021-03-04 14:14:52 +00:00
|
|
|
|
|
|
|
public static String silentDecode(String s) {
|
|
|
|
try {
|
|
|
|
return URLDecoder.decode(s, "UTF-8");
|
|
|
|
} catch (Exception e) {
|
|
|
|
// ignored
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
2020-11-12 21:19:45 +00:00
|
|
|
}
|