java.net.URLEncoder.encode I was going to use this
warning: [deprecation] encode(java.lang.String)
in java.net.URLEncoder has been deprecated
I got this warning. So what should I write instead of that?
url java network-programming deprecated
You can use a method called code in the URL Encoder class.
URLEncoder.encode(String, String)
The first parameter is the text to encode, and the second parameter is the encoding type such as UTF-TF-8.
System.out.println(
URLEncoder.encode(
"urlParameterString",
java.nio.charset.StandardCharsets.UTF_8.toString()
)
);
© 2024 OneMinuteCode. All rights reserved.