[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 235/287: Add the uri encoding function
From: |
Matthew Fidler |
Subject: |
[elpa] 235/287: Add the uri encoding function |
Date: |
Wed, 02 Jul 2014 14:46:17 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit a4309d2bf94dc029283f4ae87f800ec1e299c43d
Author: Matthew L. Fidler <address@hidden>
Date: Thu Jun 26 14:24:28 2014 -0500
Add the uri encoding function
---
ahk-us.ahk | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/ahk-us.ahk b/ahk-us.ahk
index d8ce738..55805e8 100644
--- a/ahk-us.ahk
+++ b/ahk-us.ahk
@@ -824,3 +824,61 @@ SendKey(key,Movement = 0){
}
}
}
+
+
+;functions starts
+uri_encode(Unicode_string)
+{
+;converts unicode_string to uri enocoded string for autohotkey_l unicode
version
+;http://www.autohotkey.com/forum/viewtopic.php?t=71619
+
+UTF16 := Unicode_string
+
+n := StrPutVar(UTF16, UTF8, "UTF-8")
+raw_hex := MCode_Bin2Hex(&UTF8, n-1)
+i := strlen(raw_hex)/2
+
+loop, %i%
+ {
+ frag := "%" . substr(raw_hex, a_index*2-1,2)
+ r_s .= frag
+ }
+return r_s
+
+}
+
+
+
+MCode_Bin2Hex(addr, len) {
+ Static fun
+ If (fun = "") {
+ If Not A_IsUnicode
+ h=
+ ( LTrim Join
+
8B54240C85D2568B7424087E3A53578B7C24148A07478AC8C0E90480F9090F97C3F6
+
DB80E30702D980C330240F881E463C090F97C1F6D980E10702C880C130880E464A75
+ CE5F5BC606005EC3
+ )
+ Else
+ h=
+ ( LTrim Join
+
8B44240C8B4C240485C07E53568B74240C578BF88A168AC2C0E804463C090FB6C076
+
066683C037EB046683C03066890180E20F83C10280FA09760C0FB6D26683C2376689
+ 11EB0A0FB6C26683C03066890183C1024F75BD33D25F6689115EC333C0668901C3
+ )
+ VarSetCapacity(fun, n := StrLen(h)//2)
+ Loop % n
+ NumPut("0x" . SubStr(h, 2 * A_Index - 1, 2), fun, A_Index - 1,
"Char")
+ }
+ VarSetCapacity(hex, A_IsUnicode ? 4 * len + 2 : 2 * len + 1)
+ DllCall(&fun, "uint", &hex, "uint", addr, "uint", len, "cdecl")
+ VarSetCapacity(hex, -1) ;update StrLen
+ Return hex
+}
+
+StrPutVar(string, ByRef var, encoding)
+{
+ VarSetCapacity( var, StrPut(string, encoding)
+ * ((encoding="utf-16"||encoding="cp1200") ? 2 : 1) )
+ return StrPut(string, &var, encoding)
+}
- [elpa] 219/287: `ergoemacs-select-text-in-quote' can now deal with escaped quote in string., (continued)
- [elpa] 219/287: `ergoemacs-select-text-in-quote' can now deal with escaped quote in string., Matthew Fidler, 2014/07/02
- [elpa] 233/287: Change the default option back, Matthew Fidler, 2014/07/02
- [elpa] 230/287: Fix `ergoemacs-beginning-of-line-or-what` and `ergoemacs-end-of-line-or-what`, Matthew Fidler, 2014/07/02
- [elpa] 227/287: Be more careful of cua--rectangle, Matthew Fidler, 2014/07/02
- [elpa] 232/287: Fix beginning of line function again..., Matthew Fidler, 2014/07/02
- [elpa] 238/287: Fix warnings for cua-clear-rectangle-mark., Matthew Fidler, 2014/07/02
- [elpa] 240/287: Move the fixed bracket moving to the bracket theme component., Matthew Fidler, 2014/07/02
- [elpa] 236/287: add electric-pair-made as an option, Matthew Fidler, 2014/07/02
- [elpa] 237/287: Expanded outlook integration with Emacs org-mode, Matthew Fidler, 2014/07/02
- [elpa] 234/287: Make comment-search-backward less fragile, Matthew Fidler, 2014/07/02
- [elpa] 235/287: Add the uri encoding function,
Matthew Fidler <=
- [elpa] 241/287: Cleanup for select text in quotes, Matthew Fidler, 2014/07/02
- [elpa] 243/287: Make the quote selection consistent., Matthew Fidler, 2014/07/02
- [elpa] 242/287: Fix `ergoemacs-select-text-in-ascii-quote` to work using font-lock, Matthew Fidler, 2014/07/02
- [elpa] 239/287: Allow emacs 24.4 differences for backward-up-list, Matthew Fidler, 2014/07/02
- [elpa] 248/287: Merge pull request #248 from akfoss/master, Matthew Fidler, 2014/07/02
- [elpa] 244/287: Bug fix for cutting folded lines at the end of the line., Matthew Fidler, 2014/07/02
- [elpa] 246/287: Prefer emacs 24.4 backward-up-list, Matthew Fidler, 2014/07/02
- [elpa] 249/287: Support smartparens-mode and auto-indent-mode, Matthew Fidler, 2014/07/02
- [elpa] 247/287: Revert ergoemacs-select-text-in-quote; Make expand-region consistent, Matthew Fidler, 2014/07/02
- [elpa] 245/287: Add back reduced font-lock free ergoemacs-select-text-in-ascii-quote, Matthew Fidler, 2014/07/02