Since my last question about the replacement of the space in URL-Code for Curl, everything went fine. Now by an update, the special characters in there aren't working anymore.. i need to replace them by their URL-Encode, like 'ü' gets to %C3%BC. By the modification of this, the special character gets detected correctly, but first i need to automatically modify them. My old code was the one below:
set "str1=http://192.168.0.100:1234/operations/get?token=abcde12345&subject=var1 in here&object=var2 in here with ü"
set "str2=%%20"
for /f "delims=" %%a in ('cmd /v:on /c @echo "%%str1: =!str2!%%"') do set "str3=%%~a"
curl "%str3%"
By this Code, the string works great. Now my question, how can i modify the special characters in there, which are in a variable? If i type them manually, everything gets replaced by the same function like above:
set "str1=http://192.168.0.100:1234/operations/get?token=abcde12345&subject=var1 in here&object=var2 in here with ü"
set "str2=%%20"
for /f "delims=" %%a in ('cmd /v:on /c @echo "%%str1: =!str2!%%"') do set "str3=%%~a"
set "str4=%%C3%%BC"
for /f "delims=" %%a in ('cmd /v:on /c @echo "%%str3:ü=!str4!%%"') do set "str5=%%~a"
curl "%str5%"
If these special characters are used by a variable, they don't get replaced and are still visible in the url, which causes the problem for the receiving server. Is there any solution, like setting the %str3% as my default string in this case and modify it after the first modification of the spaces or something else? Thank you.
Using the same code as the modification of the spaces; Using some other replacing codes but works only for "normal" characters, not these special ones