4
它看起来像标准Java URL类FTP客户端不能使用具有诸如“@”和“。”之类的字符的用户名。具有特殊字符的FTP URL用户名和密码
我从我的托管服务提供商处获得的用户名与“[email protected]”类似,因此整个URL看起来像是“ftp://[email protected]:[email protected]”。它适用于所有ftp客户端,但显然不适用于Java。任何建议
它看起来像标准Java URL类FTP客户端不能使用具有诸如“@”和“。”之类的字符的用户名。具有特殊字符的FTP URL用户名和密码
我从我的托管服务提供商处获得的用户名与“[email protected]”类似,因此整个URL看起来像是“ftp://[email protected]:[email protected]”。它适用于所有ftp客户端,但显然不适用于Java。任何建议
您是否尝试过编码这些字符,即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);
谢谢你的提示,它的工作后,我感动“:”出从URLEncoder.encode() – Demiurg 2010-02-17 14:05:52
我有同样的问题,你能告诉我你的意思(我感动是什么“:”出来来自URLEncoder.encode())???? 此解决方案会导致错误:“无法连接到服务器:无法登录到服务器(PASS):” – Wael 2017-01-11 10:58:29