![]() Print( ( url decode( "/search?q=%60Abdu%27l-Bah%C3%A1" ), newline ) )Ĭonst alphanum = "0123456789abcdefghijklmnopqrstuvwxyz" Function ToDecimal ( cadena As String, base_ As Uinteger ) As Uinteger Dim As Uinteger i, n, result = 0 Dim As Uinteger inlength = Len ( cadena ) For i = 1 To inlength n = Instr ( alphanum, Mid ( Lcase ( cadena ), i, 1 )) - 1 n *= ( base_ ^ ( inlength - i )) result += n Next Return result End Function Function url2string ( cadena As String ) As String Dim As String c, nc, res For j As Integer = 1 To Len ( cadena ) c = Mid ( cadena, j, 1 ) If c = "%" Then nc = Chr ( ToDecimal (( Mid ( cadena, j + 1, 2 )), 16 )) res &= nc j += 2 Else res &= c End If Next j Return res End Function Dim As String URL = "http%3A%2F%2Ffoo%20bar%2F" Print "Supplied URL '" URL "'" Print "URL decoding '" url2string ( URL ) "'" URL = "/search?q=%60Abdu%27l-Bah%C3%A1" Print ! "\nSupplied URL '" URL "'" Print "URL decoding '" url2string ( URL ) "'" Sleep Frink Print( ( url decode( "http%3A%2F%2Ffoo%20bar%2F" ), newline ) ) Result := REPR ( ( 16 * hex value( encoded ) ) PROC url decode = ( STRING encoded )STRING:ĬHAR result # returns the URL encoded string decoded - minimal error handling # ![]() PROC hex value = ( CHAR c )INT: IF c >= "0" AND c = "A" AND c <= "F" THEN 10 + ( ABS c - ABS "A" )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |