On Tuesday 30 December 2008 08:03, werner 007 wrote:
> Ok, i got the answer by my self.
> The chars of not printable and non-ascii are represented as Hex.
> To convert it back:

That'll work, but it'll also run Replace() 160 times each time you do a 
conversion.  I'd do something like this:

function urlencode(strin as string) as string
        dim strout as string
        dim i as integer
        dim a as integer
        for i = 1 to len(strin)
                a = asc(mid(strin, i, 1))
                if a < 33 or a > 126 then
                   strout = strout & "%" & Hex$(a, 2)
                else
                   strout = strout & mid(strin, i, 1)
                endif
        next
        return strout
end

Rob

------------------------------------------------------------------------------
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to