Search code examples
filenameslibcurlfile-transferftps

libcurl returns CURLE_URL_MALFORMAT with # in file name


When I try to transfer file using FTPS and destination file name has character # in your name the transfer fail with this error:

3/URL using bad/illegal format or missing URL

How inform libcurl to do not reject this character in destination file name?


Solution

  • You must URL-encode any '#' symbol as %23 in the URL to make it a URL when the letter is supposed to be part of the path, as any unencoded '#' symbol will be considered marking where the "fragment" starts.

    This is dictated by RFC3986.