I’m getting an exception saying Java URI Syntax Exception "java.io.IOException: java.net.URISyntaxException: Invalid % sequence: %wl in query at index 88:" when i try to connect from my android application.
It seems to be throwing the exception where in the URL it says "%wl" and following is the URL. is there a work around for this.
http://192.168.111.111:9000/RB/db.svc/upd?LinkId=184617ED1F21&IPs=fe80::1a46:17ff:feed:1f21%wlan0,192.168.1.127,&MNo=0771111111&sPin=000&Status=0
If you want to use
%in your URL the first you need to do is to encode it.So first you need to replace that
%with%25in your string....1f21%wlan0...with.....1f21%25wlan0....before connecting.You can use the following code for encoding the URL in Java
Have a look at the below links for more information.
1.How to encode url in java
2.URL encoding character reference
UPDATE :
If you don’t want to use URL encoder then you can try this out :
It is fine here to replace a single special character, but it would be a tedious task to do like this if you have many special characters that require proper URL encoding.