Skip to content

Instantly share code, notes, and snippets.

@schmir
Created November 19, 2014 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmir/fc0bfca6374ea7343d66 to your computer and use it in GitHub Desktop.
Save schmir/fc0bfca6374ea7343d66 to your computer and use it in GitHub Desktop.
(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Ἐ3἗f://Ἐ6Ἐ6Ἐ6.἗f἗0἗d἗8Ἐ7.἗2἗e἗c/~἗4἗b἗8/Ἐ4἗d἗8἗2἗e἗3἗4/἗2἗e἗dἘ5἗4Ἐ1Ἐ3.἗2἗6἗8?Ἐ3἗4Ἐ7Ἐ3=Ἐ3἗7἗4+Ἐ2἗4἗2Ἐ1἗4Ἐ3+἗8Ἐ2+἗eἘ4Ἐ3.+")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment