Sunday, March 19, 2017

How to do URL decoding in Java?


How to do URL decoding in Java?

In Java, I want to convert this:
https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do%3Frequest_type
To this:
https://mywebsite/docs/english/site/mybook.do&request_type


This is what I have so far:

String store = "https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do%3Frequest_type";
String store1 = URLDecoder.decode(store,"UTF-8");
System.out.println(store1);

No comments:

Post a Comment