I want to create a GET request via CUrl with variables as a batch file. The problem so far has been that the variables can also contain spaces, which does not let the link open in the CMD window.
curl -G "http://192.168.0.100:1234/operations/get?token=abcde12345&subject=var1 in here&object=var2 in here"
I always got the error message bad/illegal format or missing link. Now I have solved the problem with --data-urlencode, however special characters which are contained are also encoded as URL text.
curl -G "http://192.168.0.100:1234/operations/get" --data-urlencode "token=abcde12345" --data-urlencode "subject=var1 in here" --data-urlencode "object=var2 has some spechial chars ö ß % &"
My code works fine on this website https://reqbin.com/req/c-1n4ljxb9/curl-get-request-example for testing and all special-characters arrive correctly, only in the CMD window it changes these to the url-code...
Is there any way to replace the spaces with the usual "%20" but leave the special characters unchanged or has someone an alternative for this in the CMD-window? When I enter the URL with special characters in the browser manually, all characters arrive correctly and the spaces are replaced by themselves.