Jump to content



Recommended Posts

just whipped this up.

any better way of decoding uri's?

eg: PHP.net Uri decode function

Func URI_decode($string)
    for $i= 1 to 64
        $string = stringreplace($string, "%" & hex($i,2), chr($i))
    for $i= 90 to 97
        $string = stringreplace($string, "%" & hex($i,2), chr($i))
    for $i= 122 to 255
        $string = stringreplace($string, "%" & hex($i,2), chr($i))
    $string = stringreplace($string, "+", " ")
    return $string
Link to comment
Share on other sites

  • Moderators

I'd try to help, if I knew what a URI was... :)


The link you sent us too, doesn't even recognize URI:

Uniform Resource Identifier. A standard means of addressing resources on the Web.


Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

So would you consider this cheating?

$oSC = ObjCreate("ScriptControl")
$oSC.language = "Javascript"

$s1 = "; / ? : @ & = + $ , #"
$s2 = $oSC.eval("encodeURI('" & $s1 & "');")
$s3 = $oSC.eval("decodeURI('" & $s2 & "');")

ConsoleWrite( _
    "Original: " & $s1 & @CR & _
    "Encoded:  " & $s2 & @CR & _
    "Decoded:  " & $s3 & @CR )


Original:; / ? : @ & = + $ , #
Encoded: ;%20/%20?%20:%20@%20&%20=%20+%20$%20,%20#
Decoded: ; / ? : @ & = + $ , #


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

just whipped this up.

any better way of decoding uri's?

to be honest, your code does NO decoding. Here is something to get you started. It's ulrencode, implemented as described in the PHP manuals. I have not done a cross check with the real PHP functions, so it might be faulty !!

#include <Array.au3>

func urlencode($text)

    Local $splitted = StringSplit($text,"")

    for $i = 1 to $splitted[0]
        if $splitted[$i] = "-" or $splitted[$i] = "_" then continueloop
        if $splitted[$i] = " " then 
            $splitted[$i] = "+"
            $splitted[$i] = "%" & Hex(Asc($splitted[$i]),2)

    return _ArrayToString($splitted,"",1)

MsgBox(0,"",urlencode("Hello World_Test-22"))

Writing a decode function is pretty easy....



__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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

  • Recently Browsing   0 members

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