In addition to my last post I would like to add that, this function is for the "directories/somefile.ext" paths
In order to construct valid ftp url (with password added in it )
do this
$valid_path = "ftp://" . rawurlencode($user) . ":" . rawurlencode($pass) . ftp_url_encode($your_server_path_to_file)
Last function will encode path url so that language characters remain untouched and you get same file name for download after download dialog appears.