Created
April 16, 2015 03:27
-
-
Save jtackett/962cddfb89e0b4fe9327 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn encode-url-param [v] | |
(-> v | |
(str/replace " " "_0") | |
(str/replace "-" "_1") | |
(str/replace "&" "_2") | |
(str/replace "'" "_3") | |
(str/replace "," "_4") | |
(clojure.string/escape | |
{\[ "_5" | |
\] "_6" | |
\( "_7" | |
\) "_8"}))) | |
(defn decode-url-param [v] | |
(-> v | |
(str/replace "_0" " ") | |
(str/replace "_1" "-") | |
(str/replace "_2" "&") | |
(str/replace "_3" "'") | |
(str/replace "_4" ",") | |
(str/replace "_5" "[") | |
(str/replace "_6" "]") | |
(str/replace "_7" "(") | |
(str/replace "_8" ")"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment