I have programmed a class that get file with creating some parallel downloads. I use the simple code as below for any download :
DefaultHttpClient conn = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(new URI(M_url));
HttpResponse = conn.execute(httpPost);
In some file links (M_url) the program is okay, but when i want to download the link that contains the characters like [ ] URISyntaxException has occurred. For example, for the link http://dl.androidiha.com/games/Dead-Rider-v2.5.2[Androidiha.com].zip
error is as below :
java.net.URISyntaxException: Illegal character in path at index 48: http://dl.androidiha.com/games/Dead-Rider-v2.5.2[Androidiha.com].zipException in thread "main" java.lang.NullPointerException
What is the programmatically solution for solve this problem? I use the following code, but this can't solve my problem :
M_url = URLEncoder.encode(M_url, "UTF-8")
Thanks in advance and sorry if this topic duplicates with similar one.