I get the following warning when using java.net.URLEncoder.encode:
warning: [deprecation] encode(java.lang.String)
in java.net.URLEncoder has
Use the other encode method in URLEncoder:
URLEncoder.encode(String, String)
The first parameter is the text to encode; the second is the name of the character encoding to use (e.g., UTF-8). For example:
System.out.println(
URLEncoder.encode(
"urlParameterString",
java.nio.charset.StandardCharsets.UTF_8.toString()
)
);