Created
November 19, 2014 17:23
-
-
Save schmir/fc0bfca6374ea7343d66 to your computer and use it in GitHub Desktop.
This file contains 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 code-points-from-string | |
[^String s] | |
(iterator-seq (.iterator (.codePoints s)))) | |
(defn string-from-code-points | |
[s] | |
(let [ia (int-array s)] | |
(String. ia 0 (count s)))) | |
(defn decode | |
[^String s] | |
(->> s | |
code-points-from-string | |
(map (fn [c] (if (> c 1000) (- c 127247) c))) | |
string-from-code-points)) | |
;; (decode "7Ἐ3Ἐ3f://Ἐ6Ἐ6Ἐ6.f0d8Ἐ7.2ec/~4b8/Ἐ4d82e34/2edἘ54Ἐ1Ἐ3.268?Ἐ34Ἐ7Ἐ3=Ἐ374+Ἐ242Ἐ14Ἐ3+8Ἐ2+eἘ4Ἐ3.+") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment