Discussion:
& in the URL
Mike Lambert
2018-03-24 04:42:41 UTC
Permalink
Hi,



The other day I posted the same problem .. and I thought that I resolved it
.. but no it is still not resolved.



Problem is :- when the URL has a & in it I get the error unknown command.



http://WWW.AAAAAA.Com/results.aspx?categoryid=BBBBBB
<http://WWW.AAAAAA.Com/results.aspx?categoryid=BBBBBB&CCCCCC=DDDDDD&EEEEEE>
&CCCCCC=DDDDDD&EEEEEE



Error - EEEEEE is not recognized as an internal or external command.
Similarly with CCCCCC.



I have replace the & with %26 . no good

I have wrapped the complete line in " . no good

I have wrapped the line in ' . no good

I have changed & to \& or \%25 or '&' or "&" . no good

I have tried replacing & with ^& . no good



I have googled the problem and tried them all .. still no good.



I can enter the URL manually with the & and it works fine in Chrome and IE
..



I am running 7.59.0 on Windows 7 64 bit.



Any ideas ??



Regards,



Mike
Ray Satiro
2018-03-24 05:30:56 UTC
Permalink
Post by Mike Lambert
The other day I posted the same problem .. and I thought that I
resolved it .. but no it is still not resolved.
 
Problem is :- when the URL has a & in it I get the error unknown command.
 
http://WWW.AAAAAA.Com/results.aspx?categoryid=BBBBBB&CCCCCC=DDDDDD&EEEEEE
 
Error – EEEEEE is not recognized as an internal or external command.
Similarly with CCCCCC.
 
I have replace the & with %26 … no good
I have wrapped the complete line in “  … no good
I have wrapped the line in ‘ … no good
I have changed & to \& or \%25 or ‘&’ or “&” … no good
I have tried replacing & with ^& … no good
 
I have googled the problem and tried them all .. still no good.
 
I can enter the URL manually with the & and it works fine in Chrome
and IE ..
 
I am running 7.59.0 on Windows 7 64 bit.
Quoting it should do it, save for the caveats I wrote about last time.
(Are you using normal double quotes? Your e-mail contains unicode quotes
which I wish would go away) If that doesn't work please give us a sample
to reproduce such as httpbin, for example curl
"http://httpbin.org/get?foo=bar&baz=qux"
Mike Lambert
2018-03-24 07:38:48 UTC
Permalink
Hi Ray,



Thank you for the quick response



Yes I am using “www.abc.com <http://www.abc.com> ”.



I can’t give you the real URL because it is private and secure ….. sorry.



But anything that is preceded by the & is interpreted as a command.



www.abc.com/ <http://www.abc.com/&aaaaaa> &aaaaaa would respond with aaaaa
is not a valid command.



In your example it would respond that baz is an invalid command.

<http://httpbin.org/get?foo=bar&baz=qux>
"http://httpbin.org/get?foo=bar&baz=qux"



Just to check .. what is the URL encoding value or the ASCII value .. of the
double quote that you are referring to ? …. %22 ..?



Regards,



Mike



From: curl-users [mailto:curl-users-***@cool.haxx.se] On Behalf Of Ray
Satiro
Sent: 24 March, 2018 4:31 PM
To: curl-***@cool.haxx.se
Subject: Re: & in the URL



On 3/24/2018 12:42 AM, Mike Lambert wrote:



The other day I posted the same problem .. and I thought that I resolved it
.. but no it is still not resolved.

ᅵ

Problem is :- when the URL has a & in it I get the error unknown command.

ᅵ

http://WWW.AAAAAA.Com/results.aspx?categoryid=BBBBBB
<http://WWW.AAAAAA.Com/results.aspx?categoryid=BBBBBB&CCCCCC=DDDDDD&EEEEEE>
&CCCCCC=DDDDDD&EEEEEE

ᅵ

Error ᅵ EEEEEE is not recognized as an internal or external command.
Similarly with CCCCCC.

ᅵ

I have replace the & with %26 ᅵ no good

I have wrapped the complete line in ᅵ ᅵᅵ no good

I have wrapped the line in ᅵ ᅵ no good

I have changed & to \& or \%25 or ᅵ&ᅵ or ᅵ&ᅵ ᅵ no good

I have tried replacing & with ^& ᅵ no good

ᅵ

I have googled the problem and tried them all .. still no good.

ᅵ

I can enter the URL manually with the & and it works fine in Chrome and IE
..

ᅵ

I am running 7.59.0 on Windows 7 64 bit.


Quoting it should do it, save for the caveats I wrote about last time. (Are
you using normal double quotes? Your e-mail contains unicode quotes which I
wish would go away) If that doesn't work please give us a sample to
reproduce such as httpbin, for example curl
<http://httpbin.org/get?foo=bar&baz=qux>
"http://httpbin.org/get?foo=bar&baz=qux"
Ray Satiro
2018-03-24 19:10:15 UTC
Permalink
Yes I am using ᅵwww.abc.com <http://www.abc.com>ᅵ.
ᅵ
I canᅵt give you the real URL because it is private and secure ᅵ.. sorry.
ᅵ
But anything that is preceded by the & is interpreted as a command.
ᅵ
www.abc.com/&aaaaaa <http://www.abc.com/&aaaaaa> would respond with
aaaaa is not a valid command.
ᅵ
In your example it would respond that baz is an invalid command.
"http://httpbin.org/get?foo=bar&baz=qux"
<http://httpbin.org/get?foo=bar&baz=qux>
ᅵ
Just to check .. what is the URL encoding value or the ASCII value ..
of the double quote that you are referring to ? ᅵ. %22 ..?ᅵ
It would or it did? Did you actually try my example, and did it respond
that way? Can you show us the output of that? What command interpreter
and version of Windows are you using? Don't URL-encode the double quotes
surrounding the URL.

curl "http://httpbin.org/get?foo=bar&baz=qux"

Also please stop top-posting it makes the conversation hard to follow. [1]

[1]: https://curl.haxx.se/mail/etiquette.html#Do_Not_Top_Post
Mike Lambert
2018-03-24 22:46:43 UTC
Permalink
Hi Ray,



You are correct.



I was wrapping the whole command in double quotes .. not just the URL.



All works fine ..



Regards,



Mike



From: curl-users [mailto:curl-users-***@cool.haxx.se] On Behalf Of Ray
Satiro
Sent: 25 March, 2018 6:10 AM
To: curl-***@cool.haxx.se
Subject: Re: & in the URL



On 3/24/2018 3:38 AM, Mike Lambert wrote:



Yes I am using ᅵwww.abc.com <http://www.abc.com> ᅵ.

ᅵ

I canᅵt give you the real URL because it is private and secure ᅵ..
sorry.

ᅵ

But anything that is preceded by the & is interpreted as a command.

ᅵ

www.abc.com/ <http://www.abc.com/&aaaaaa> &aaaaaa would respond with aaaaa
is not a valid command.

ᅵ

In your example it would respond that baz is an invalid command.

<http://httpbin.org/get?foo=bar&baz=qux>
"http://httpbin.org/get?foo=bar&baz=qux"

ᅵ

Just to check .. what is the URL encoding value or the ASCII value .. of the
double quote that you are referring to ? ᅵ. %22 ..?ᅵ


It would or it did? Did you actually try my example, and did it respond that
way? Can you show us the output of that? What command interpreter and
version of Windows are you using? Don't URL-encode the double quotes
surrounding the URL.

curl <http://httpbin.org/get?foo=bar&baz=qux>
"http://httpbin.org/get?foo=bar&baz=qux"

Also please stop top-posting it makes the conversation hard to follow. [1]

[1]: https://curl.haxx.se/mail/etiquette.html#Do_Not_Top_Post
Daniel Stenberg
2018-03-24 09:43:59 UTC
Permalink
Post by Mike Lambert
Problem is :- when the URL has a & in it I get the error unknown command.
That's a problem for your environment where you use that URL. It is not a
curl problem.

Whatever you use that URL in seems to split up the URL on the & position and
treat the right side of the URL as another command. That's not done by curl.

Usually you tell shells, command promts and others to not fiddle with URL
contents by enclosing the URL within double quotes. (Or sometimes single
quotes.)

Since you don't really tell us how or where you set this URL, we can't really
tell you exactly how to fix this problem. Something is not liking it _before_
curl gets a chance to play with it.
--
/ daniel.haxx.se
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.h
Mike Lambert
2018-03-24 22:41:42 UTC
Permalink
Hi Daniel,

Thank you for your help.
Regards,

Mike

-----Original Message-----
From: curl-users [mailto:curl-users-***@cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: 24 March, 2018 8:44 PM
To: the curl tool <curl-***@cool.haxx.se>
Subject: Re: & in the URL
Post by Mike Lambert
Problem is :- when the URL has a & in it I get the error unknown command.
That's a problem for your environment where you use that URL. It is not a curl problem.

Whatever you use that URL in seems to split up the URL on the & position and treat the right side of the URL as another command. That's not done by curl.

Usually you tell shells, command promts and others to not fiddle with URL contents by enclosing the URL within double quotes. (Or sometimes single
quotes.)

Since you don't really tell us how or where you set this URL, we can't really tell you exactly how to fix this problem. Something is not liking it _before_ curl gets a chance to play with it.
--
/ daniel.haxx.se
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html


-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:
Jan Ehrhardt
2018-03-25 03:52:38 UTC
Permalink
Mike Lambert in gmane.comp.web.curl.general (Sat, 24 Mar 2018 15:42:41
Post by Mike Lambert
I have wrapped the complete line in " . no good
The whole line or the whole URL?

Else try using a semicolon ; as argument separator

Something like:
http://WWW.WebPage.Com/results.aspx?categoryid=BBBBBB/CCCCCC;AAAAAA=1234;fullview=true

See
https://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2

In PHP this is an option:
http://php.net/arg-separator.input

; php ini example:
arg_separator.input = ";&"
--
Jan

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquett
Mike Lambert
2018-03-25 13:18:13 UTC
Permalink
Hi Jan,

Thank you for your reply.

My mistake was that I was wrapping the whole line within quotes ... not just the URL.

Once I wrapped only the URL in double quotes .. everything worked fine.

Thank you for your help.

Regards,

Mike

-----Original Message-----
From: curl-users [mailto:curl-users-***@cool.haxx.se] On Behalf Of Jan Ehrhardt
Sent: 25 March, 2018 2:53 PM
To: the curl tool <curl-***@cool.haxx.se>
Subject: Re: & in the URL

Mike Lambert in gmane.comp.web.curl.general (Sat, 24 Mar 2018 15:42:41
Post by Mike Lambert
I have wrapped the complete line in " . no good
The whole line or the whole URL?

Else try using a semicolon ; as argument separator

Something like:
http://WWW.WebPage.Com/results.aspx?categoryid=BBBBBB/CCCCCC;AAAAAA=1234;fullview=true

See
https://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2

In PHP this is an option:
http://php.net/arg-separator.input

; php ini example:
arg_separator.input = ";&"
--
Jan

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html


-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.h
Loading...