Special characters like @ and & in cURL POST data
cURL > 7.18.0 has an option --data-urlencode
which solves this problem. Using this, I can simply send a POST request as
curl -d name=john --data-urlencode passwd=@31&3*J https://www.example.com
Summarizing the comments, in case of mixed "good" and "bad" data and exclamation marks inside we can use on Windows:
curl -d "grant_type=client_credentials&client_id=super-client&acr_values=tenant:TNT123" --data-urlencode "client_secret=XxYyZ21D8E&%fhB6kq^mXQDovSZ%Q*!ipINme" https://login.example.com/connect/token
How about using the entity codes...
@ = %40
& = %26
So, you would have:
curl -d 'name=john&passwd=%4031%263*J' https://www.mysite.com
Double quote (" ") the entire URL
.It works.
curl "http://www.mysite.com?name=john&passwd=@31&3*J"
Just found another solutions worked for me. You can use '\' sign before your one special.
passwd=\@31\&3*J