Reputation: 1669
It looks like standard Java URL class FTP client cannot work with username having characters such as "@" and ".".
The username I get from my hosting provider is something like "[email protected]", so the whole URL looks like "ftp://[email protected]:[email protected]". It works perfectly with all ftp clients, but apparently not with Java. Any suggestions
Upvotes: 4
Views: 7695
Reputation: 36115
Have you tried to encode these characters, i.e. username%40domain.com:password
?
String ftpUser = URLEncoder.encode(username, "UTF-8");
String ftpPass = URLEncoder.encode(password, "UTF-8");
String url = String.format("ftp://%s:%[email protected]", ftpUser, ftpPass);
Upvotes: 7