I am trying to download files from a server using FTP protocol in java.
By using following URL I am able to connect to the server & download files.
URL url = new URL("ftp://"+user+":"+password+"@"+host+"/"+remoteFile+";type=i");
But when my password contains the “@” (ex : soft@2011) symbol it throws the following exception:
java.net.UnknownHostException: 2010@192.168.1.100
It is not able to differentiate both “@” symbols.
How can I avoid this problem? Can I use any escape characters to avoid this problem?
URI encoding the password (and preferably the user name as well) should work just fine.