I am trying to create a link with URLEncoder
, but me unsupported The encoding exception is obtained
and I do not know why?
string parameter1 = "a"; String param2 = "b"; String key = "key"; String H = "H"; Public static zero major (string [] args) {try {URLEncoder.encode (param1, key); Url encoder Encode (absolute 2, h); } Hold (exception e) {e.printStackTrace (); }
Can anyone help me?
URLNcoder. Two parameters.
1: The value has to be encoded.
2: The name of the encoding (such as UTF-8)
So in your case, you want to do something like this:
Fixed string param1 = "A"; Fixed string param2 = "b"; Public static zero main (string [] args) {try {stringbuilder url = new stringbuilder (); Url.append ("& amp; key ="); Url.append (URLEncoder.encode (Ultimate 1, "UTF-8")); Url.append ("& amp; H ="); Url.append (URLEncoder.encode (param2, "UTF-8")); Println (url); } Hold (exception e) {e.printStackTrace (); }}
No comments:
Post a Comment