timwilky
13-07-07, 02:51 PM
I need to encode some text in order to use it within a url.
for instance space characters need to be encoded as %20 etc.
I was tying to use the character substitution in an environment variable
for instance
SET STRING=%1%
SET STRING=%STRING: =%20% (How to I escape the % in the %20)
echo %STRING%
Where the argument to the script would be the text to encode " delimited, ie. "encode this string" where I would expect the output to be "encode%20this%20string"
Otherwise I am going to have to write a bit of C just to do this noddy requirement.
for instance space characters need to be encoded as %20 etc.
I was tying to use the character substitution in an environment variable
for instance
SET STRING=%1%
SET STRING=%STRING: =%20% (How to I escape the % in the %20)
echo %STRING%
Where the argument to the script would be the text to encode " delimited, ie. "encode this string" where I would expect the output to be "encode%20this%20string"
Otherwise I am going to have to write a bit of C just to do this noddy requirement.