diff --git a/plugin/src/main/groovy/org/unify4j/common/Request4j.java b/plugin/src/main/groovy/org/unify4j/common/Request4j.java index ac017fe..62c4b91 100644 --- a/plugin/src/main/groovy/org/unify4j/common/Request4j.java +++ b/plugin/src/main/groovy/org/unify4j/common/Request4j.java @@ -4,6 +4,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; @@ -24,7 +25,7 @@ public class Request4j { * @param params A map containing query parameters to be appended to the URL. * @return The URL string with appended query parameters. */ - public static String appendQueryParams(String url, Map params) { + public static String appendQueryParams(String url, Map params) throws UnsupportedEncodingException { if (Collection4j.isEmptyMap(params) || String4j.isEmpty(url)) { return url; } @@ -38,8 +39,8 @@ public static String appendQueryParams(String url, Map params) { builder.append('&'); } String value = String.valueOf(params.get(param)); - builder.append(URLEncoder.encode(param, StandardCharsets.UTF_8)).append('='); - builder.append(URLEncoder.encode(value, StandardCharsets.UTF_8)); + builder.append(URLEncoder.encode(param, StandardCharsets.UTF_8.displayName())).append('='); + builder.append(URLEncoder.encode(value, StandardCharsets.UTF_8.displayName())); } return builder.toString(); }