urlencode a string?

Blitz3D Forums/Blitz3D Programming/urlencode a string?

vivaigiochi(Posted 2010) [#1]
I read an html page (downloaded with blitzget-ok!) when i extract some piece of string i see %26%24 and other code similar.
But i need the string less this code..


vivaigiochi(Posted 2010) [#2]
solved for my need i think

look this code

htmlstringa$="SHE2648_00-GAL-global%3Fwid%3D430%26hei%3D430%26%24jpglarge%24"

begin=1
temp$=""
temp2$=""

pos=0

numcar=Len(htmlstringa)

finito=0

Print htmlstringa
While begin<numcar And finito=0

trovato=Instr(htmlstringa,"%",begin)
If trovato<>0 Then
stringasx$=Mid(htmlstringa,1,trovato-1)
stringadx$=Mid(htmlstringa,trovato+3,numcar)
numesa$=Mid(htmlstringa,trovato+1,2)
htmlstringa=stringasx$+Chr(hex2dec(numesa$))+stringadx$
begin=trovato
Else
finito=1
EndIf
Wend

Print htmlstringa$

Delay 5000

Function hex2dec(hexin$)
Local c, dec, hexval$ = "0123456789ABCDEF"
For c=1 To Len(hexin$)
dec = (dec Shl 4) Or (Instr(hexval$, Upper$(Mid$(hexin$, c, 1))) - 1)
Next
Return dec
End Function


vivaigiochi(Posted 2010) [#3]
updated tha networking code archive

http://www.blitzbasic.com/codearcs/codearcs.php?code=2657