Android: howto parse URL String with spaces to URI object?
- by Mannaz
I have a string representing an URL containing spaces and want to convert it to an URI object. If is simple try to do
String myString = "http://myhost.com/media/mp3s/9/Agenda of swine - 13. Persecution Ascension_ leave nothing standing.mp3";
URI myUri = new URI(myString);
it gives me
java.net.URISyntaxException: Illegal character in path at index X
where index X is the position of the first space in the URL string.
How can i parse myStringinto a URI object?