Malformed URL error when using 'temp_client@domain.com' FTP user name

I've got a very quick question for you guys.

I've been testing a simple FTP upload program and I tested it with my main FTP account and it worked fine.

URL url =new URL("ftp://user:pass@ftp.domain.com/" + inputFile.getName());

I've now set up an new FTP account with my hosting provider and restricted it to a specific directory called "temp_client" on the server for security reasons. However, my hosting provider has automatically given the username as "temp_client@domain.com" and there's no way for me to change it. This gives the following code:

URL url =new URL("ftp://temp_client@domain.com:pass@ftp.domain.com/" + inputFile.getName());

Obviously Java gets confused because there are two @ symbols in the URL. My question is: is there a way of using the username temp_client@domain.com successfully without confusing Java?

Thanks.

Message was edited by:

shookster

[1048 byte] By [shookstera] at [2007-11-27 10:48:18]
# 1

I fixed it and I'm embarrassed that I didn't think of it earlier, it was so simple.

I used URLEncoder.encode(username) and it worked fine with no problems.

shookstera at 2007-7-28 22:25:49 > top of Java-index,Core,Core APIs...