Jump to content

URLencoder


Libre
 Share

Recommended Posts

This script covert a simple string to a valid url for a web server.

;#####################################################################
;  URLEncode(x) convierte la direccion web a lo que el servidor quiere
;#####################################################################

Func URLEncode( $urlText ) 
        
    $url =""
    
    For $i = 1 To  StringLen($urlText)
        $acode = Asc(StringMid( $urlText, $i, 1 ) )
        Select 
            Case ( $acode>=48 and $acode <= 57 )or _
            ( $acode>=65 and $acode <= 90 )or _
            ( $acode>=97 and $acode <= 122 )
                $url = $url & StringMid($urlText, $i, 1)
            Case $acode=32
                $url = $url & "+"
            Case Else
                $url = $url & "%" & Hex($acode,2)
        EndSelect
    Next
 
    return $url

EndFunc
Edited by Libre

I love this Game :p----------------------Freeware Multilange support or Translate your scripts----------------------aNyBoDy KnOwS WhY A LiGhT iN My KeYbOaRd iS aLlWaIs BlInKiNg !?Who is "General Failure" and what is he doing in my hard disk !!!!!?

Link to comment
Share on other sites

nice script i used this for quick converting but nice UDF, I could really use this.

$i = URLEncode(InputBox("convert","enter text"))
MsgBox(0,"",$i)

Func URLEncode( $urlText )
        
    $url =""
    
    For $i = 1 To  StringLen($urlText)
        $acode = Asc(StringMid( $urlText, $i, 1 ) )
        Select
            Case ( $acode>=48 and $acode <= 57 )or _
            ( $acode>=65 and $acode <= 90 )or _
            ( $acode>=97 and $acode <= 122 )
                $url = $url & StringMid($urlText, $i, 1)
            Case $acode=32
                $url = $url & "+"
            Case Else
                $url = $url & "%" & Hex($acode,2)
        EndSelect
    Next

    return $url

EndFunc

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

I might be wrong but i think this can already be done with _INetExplorerCapable() which is included in inet.au3.

anyway. good job and welcome to the forums.

Edit: nvm. this one converts all characters. cool. :o

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

  • 5 weeks later...

This script covert a simple string to a valid url for a web server.

Just wanted to say thanks - this is exactly what I need for a project I'm working on, you saved me a lot of trouble! :think:

Edited by MFerris
Link to comment
Share on other sites

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...