cURL / Mailing Lists / curl-users / Single Mail

curl-users

Apostrophe Causing "Output" To Fail?

From: Art Pena <apena_at_xnet.com>
Date: Fri, 21 Nov 2003 08:06:30 -0600

Hi there,
I've just learned about and started to use CURL, but am having a
problem fetching images from a web address if the URL contains an
apostrophe ('). Not in the fetch, more specifically, it appears to not
save the images correctly to my local drive when the URL has an
apostrophe. With the following statement in my JavaScript:

      "curl --silent " + cameraSource + " --max-time 300 -w
\"%{http_code}\\n\" --output Resources/Cache/cache.jpg"

I get great results if the "cameraSource" is something like this:

      http://192.168.1.152/Webcam%20Repository/Webcam%20Test/001.jpg

But if "cameraSource" is something like this, the file saved has errors:

      http://192.168.1.152/Webcam%20Repository/Jim's%20Webcam/001.jpg

I cannot even open the saved file in a program like Photoshop, because
it says this:

      Could not open "cache.jpg" because a JPEG marker segment length is
too short (the file may be truncate or incomplete)

Is there a statement or something I'm missing that's causing an
incorrect "output" when an apostrophe is present? I tried escaping the
apostrophe \' in the URL with the JavaScript "replace" command - but
that led the the URL being invalid. And for URL's I have no control
over, I cannot remove the apostrophe from their web address. Thank you
in advance for the time,
AP

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-21