Idle Banter For non SV and non bike related chat (and the odd bit of humour - but if any post isn't suitable it'll get deleted real quick).![]() |
![]() |
|
Thread Tools |
![]() |
#1 |
Member
Mega Poster
Join Date: Mar 2004
Location: Not in Yorkshire. (Thank God)
Posts: 4,116
|
![]()
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.
__________________
Not Grumpy, opinionated. Last edited by timwilky; 13-07-07 at 02:54 PM. |
![]() |
![]() |
![]() |
#2 |
Guest
Posts: n/a
|
![]()
Encode was where i got confused Tim sorry mate lol
|
![]() |
![]() |
#3 |
Member
Mega Poster
Join Date: Jul 2003
Location: Doncaster, oop norf
Posts: 2,128
|
![]()
Does this help? Can you adapt it? Try PMing TSM, he's a geek.
http://www.syronex.com/antispam/help...cipient-mailto |
![]() |
![]() |
![]() |
#4 |
Member
Mega Poster
Join Date: Mar 2004
Location: Not in Yorkshire. (Thank God)
Posts: 4,116
|
![]()
unfortunately that is javascript. What I am attempting to do is format arguments that I will pass to a wget command. So they have to look as if a browser etc has already encoded them
__________________
Not Grumpy, opinionated. |
![]() |
![]() |
![]() |
#5 |
Guest
Posts: n/a
|
![]()
I'm guessing it's not just spaces your trying to encode as %20
If it is, does this little batch file help? @echo off echo %1%%20%2%%20%3 run it as test.bat test1 test2 test3 and the output is test1%20test2%20test3 Probably a bit basic, and not sure how you would make it work for different length strings though .... |
![]() |
![]() |
#6 |
The Sick Man
Mega Poster
Join Date: Nov 2004
Location: Peckham.SE.LDN
Posts: 4,768
|
![]()
i assume that you are using the linux "wget" port, you could with a perl script do below.
Code:
#!/usr/bin/perl sub URLenc{ $urlstr = $_[0]; $urlstr =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; return $urlstr; } print URLenc(shift); Code:
wget "http://server/file to get.html"
__________________
OTR: KTM 690 Duke R 2015 Full Akro SIDELINE: Kwak ZX636 A1P 2002, Red, R&G's, Yoshi, Double Bubble Screen GONE: Kwak ZX-7R P1, Full Akro, Undertray, Screen GONE: SV650S K2 Very Bruised & Without Fairing, Motovation Frame Sliders, R&G Ally Sprocket Toe Protector, HEL 2 Line Setup, GSXR K1 600 RWU Forks, Barnett Clutch & Springs, Penske 8981 Shock, Gilles Ti Rearsets, Steel Barends, Scottoiler, AFAM Chain & Sprockets, Twin FIAMM Horns, Skidmarx Bellypan, Full Micron Zeta Steel System, Cut down undertay. Forum Problems & Information / Site Suggestions |
![]() |
![]() |
![]() |
Thread Tools | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Rainbow script that never was | Defender | Idle Banter | 2 | 18-04-08 02:59 PM |
Windows Media Player... Help Needed! | Speedy Claire | Idle Banter | 17 | 02-02-08 01:12 PM |
Windows script help | tricky | Idle Banter | 2 | 29-03-07 11:55 AM |
Windows 97 Help needed re format painter | mattSV | Idle Banter | 4 | 25-10-06 04:11 PM |
Script help | sharriso74 | Idle Banter | 13 | 03-02-06 03:53 PM |