cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Apostrophe Causing "Output" To Fail?

From: Art Pena <apena_at_xnet.com>
Date: Fri, 21 Nov 2003 18:33:22 -0600

Well,
I found out that I had to "double escape" by apostrophes will calling
this from my JavaScript, like so:

var escapedCamImage = unescapedCamImage.replace(/'/g, "\\'");

And it's all good. Thanks!

On Friday, November 21, 2003, at 11:17 AM, Roth, Kevin P. wrote:

> -----Original Message-----
> From: Art Pena
> Sent: Friday, November 21, 2003 10:06 AM
>
>> Thanks for the tip. I did as you suggested, but it does appear to be
>> (the start of) a valid image file:
>
> You might also look at the end of the file to see if some extra text
> got in there.
>
> What are the exact file sizes when it does and doesn't work? That info
> might yield a clue.
>
> Is it possible that your webcam was in the middle of updating its
> photo when you tried the URL with the apostrophe in it? (e.g. is this
> repeatable every single time, or did you just get unlucky a couple
> times and assume the apostrophe caused it)
>
>
>> Or, how can I incorporate "-f" into my string to try and debug
>
> Normally you'd just add it in; if a non-successful http_code was
> returned, instead of outputting your (possibly corrupted) file, curl
> would instead 'die' with an exit code of 22, and would print an error
> message (to stderr I assume) explaining why it just quit.
>
> But, I notice you've got a -w (--write-out) statement in use, which
> already shows you the same thing, so the -f may not be useful.
>
>
> - Kevin
>
>
> On Friday, November 21, 2003, at 08:22 AM, Roth, Kevin P. wrote:
>>> "curl --silent " + cameraSource + " --max-time 300 -w
>>> \"%{http_code}\\n\" --output Resources/Cache/cache.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
>>
>>> Could not open "cache.jpg" because a JPEG marker segment length is
>>> too short (the file may be truncate or incomplete)
>>
>> Try opening the resulting output file in a text editor (rename it
>> to cache.txt if needed) and see what's in there. I wonder if you
>> won't find some kind of web server error rather than the image
>> data you're expecting.
>
>
> -------------------------------------------------------
> 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/
>

-------------------------------------------------------
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-22