|
@@ -9,6 +9,8 @@ import javax.xml.bind.DatatypeConverter;
|
|
|
import java.io.BufferedInputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.security.MessageDigest;
|
|
|
import java.util.Base64;
|
|
@@ -98,4 +100,20 @@ public class CodecUtils {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static String urlEncode(String text) {
|
|
|
+ try {
|
|
|
+ return URLEncoder.encode(text, StandardCharsets.UTF_8.name());
|
|
|
+ } catch (Exception e) {
|
|
|
+ return text;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String urlDecode(String text) {
|
|
|
+ try {
|
|
|
+ return URLDecoder.decode(text, StandardCharsets.UTF_8.name());
|
|
|
+ } catch (Exception e) {
|
|
|
+ return text;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|