Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/URL-encoding/AutoHotkey/url-encoding.ahk
Normal file
17
Task/URL-encoding/AutoHotkey/url-encoding.ahk
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
MsgBox, % UriEncode("http://foo bar/")
|
||||
|
||||
; Modified from http://goo.gl/0a0iJq
|
||||
UriEncode(Uri, Reserved:="!#$&'()*+,/:;=?@[]") {
|
||||
Unreserved := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~"
|
||||
VarSetCapacity(Var, StrPut(Uri, "UTF-8"), 0)
|
||||
StrPut(Uri, &Var, "UTF-8")
|
||||
While (Code := NumGet(Var, A_Index - 1, "UChar")) {
|
||||
If InStr(Unreserved . Reserved, Chr(Code)) {
|
||||
Encoded .= Chr(Code)
|
||||
}
|
||||
Else {
|
||||
Encoded .= Format("%{:02X}", Code)
|
||||
}
|
||||
}
|
||||
Return Encoded
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue