Jump to content

a tipical run function


Recommended Posts

Hi, when I run

FixEncode('&#109 ;&#097 ;" onmouseover')     ;without space between numbres and semicolon

Func FixEncode($vHTML)
$resultado =StringRegExpReplace($vHTML, '\&\#([0-9]+)\;',("\1"))
ConsoleWrite( $resultado)
return ($resultado)
EndFuncoÝ÷ Ú·­º¹â¶Ø^rëyËh "{¦n·¬×OZÝ=í»­Â§!Øb+hjëh×6FixEncode('&#109 ;&#097 ;" onmouseover')

Func FixEncode($vHTML)
$resultado =StringRegExpReplace($vHTML, '\&\#([0-9]+)\;',chr("\1"))
ConsoleWrite( $resultado)
return ($resultado)
EndFunc

It don`t return nothing (should be "ma")

whait is the razon???????

Link to comment
Share on other sites

Why do you keep posting over and over? Post once or you will ignored.

I found this solution

Func FixEncode($vString )
While 1
    $regexp = StringRegExp($vString, '\&\#([0-9]+)\;', 1)
    If UBound($regexp) >= 1 Then
        $regexp = Chr($regexp[0])
        $vString = StringRegExpReplace($vString, '\&\#([0-9]+)\;', $regexp, 1)  
    Else
        ExitLoop
    EndIf
WEnd
return ($vstring)
EndFunc

and other note, this forum can accept UNICode Chars. For this razon I did post twice it

Link to comment
Share on other sites

Hi, when I run

FixEncode('&#109 ;&#097 ;" onmouseover')     ;without space between numbres and semicolon

Func FixEncode($vHTML)
$resultado =StringRegExpReplace($vHTML, '\&\#([0-9]+)\;',chr("\1"))
ConsoleWrite( $resultado)
return ($resultado)
EndFunc

It don`t return nothing (should be "ma")

whait is the razon???????

Read this post for an explanation.

Why chr("\1") will not work in StringRegExReplace()

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

I saw that, I tried to replace the \1 for $1, but that does not work

The difference between "\1" and $1 was not the point. The Chr() function is run before the StringRegExpReplace() gets done at all. Since your input to Chr() is a string vice an integer, it is equivalent to Chr(0) which is a null character. The substitution does actually happen, but a null character is inserted, with terminates the string at the first character when you try to display it:
FixEncode('ma" onmouseover');without space between numbres and semicolon

Func FixEncode($vHTML)
    $resultado = StringRegExpReplace($vHTML, '\&\#([0-9]+)\;', Chr("\1"))
    ConsoleWrite("@error = " & @error & "  @extended = " & @extended & @LF)
    ConsoleWrite("Lenth = " & BinaryLen($resultado) & @LF)
    ConsoleWrite("Binary = " & StringToBinary($resultado) & @LF)
    ConsoleWrite("$resultado = " & $resultado & @LF)
    Return ($resultado)
EndFunc ;==>FixEncode

I think your multiple posting was caused by trying to work around the awkward formatting on the forum, so I'm sympathetic. Try using the code tags and avoid the autoit tags, they are buggy.

;)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...