Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Global $var[4] = [0,@DesktopWidth/2,@DesktopHeight/2]
- Global $va2[5] = [GUICreate('',$var[1],$var[2]),$var[2]-30,$var[1]/2,0]
- Global $GUI[5] = [GUICtrlCreateButton('Giải mã',$va2[2],$va2[1],$va2[2],30),GUICtrlCreateButton('Mã hóa',0,$va2[1],$va2[2],30),GUISetState(@SW_SHOW),GUICtrlCreateEdit('',0,0,$var[1],$va2[1])]
- Func _UnicodeURLEncode($UnicodeURL)
- $UnicodeBinary = StringToBinary ($UnicodeURL, 4)
- $UnicodeBinary2 = StringReplace($UnicodeBinary, '0x', '', 1)
- $UnicodeBinaryLength = StringLen($UnicodeBinary2)
- Local $EncodedString
- For $i = 1 To $UnicodeBinaryLength Step 2
- $UnicodeBinaryChar = StringMid($UnicodeBinary2, $i, 2)
- If StringInStr("$-_.+!*'(),;/?:@=&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", BinaryToString ('0x' & $UnicodeBinaryChar, 4)) Then
- $EncodedString &= BinaryToString ('0x' & $UnicodeBinaryChar)
- Else
- $EncodedString &= '%' & $UnicodeBinaryChar
- EndIf
- Next
- Return $EncodedString
- EndFunc ;==>_UnicodeURLEncode
- Func _UnicodeURLDecode($toDecode)
- Local $strChar = "", $iOne, $iTwo
- Local $aryHex = StringSplit($toDecode, "")
- For $i = 1 To $aryHex[0]
- If $aryHex[$i] = "%" Then
- $i = $i + 1
- $iOne = $aryHex[$i]
- $i = $i + 1
- $iTwo = $aryHex[$i]
- $strChar = $strChar & Chr(Dec($iOne & $iTwo))
- Else
- $strChar = $strChar & $aryHex[$i]
- EndIf
- Next
- $Process = StringToBinary (StringReplace($strChar, "+", " "))
- $DecodedString = BinaryToString ($Process, 4)
- Return $DecodedString
- EndFunc ;==>_UnicodeURLDecode
- While 1
- Switch GUIGetMsg()
- Case -3
- Exit
- Case $GUI[1]
- GUICtrlSetData($GUI[3],_UnicodeURLEncode(GUICtrlRead($GUI[3])))
- Case $GUI[0]
- GUICtrlSetData($GUI[3],_UnicodeURLDecode(GUICtrlRead($GUI[3])))
- EndSwitch
- WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement