Skip to content

Instantly share code, notes, and snippets.

@rotaliator
Last active February 3, 2021 23:11
Show Gist options
  • Save rotaliator/72546489cf1497eb95c3b54ffebd79a0 to your computer and use it in GitHub Desktop.
Save rotaliator/72546489cf1497eb95c3b54ffebd79a0 to your computer and use it in GitHub Desktop.
Remove polish characters
(require '[clojure.string :as str])
(defn remove-pl [s]
(str/escape s (zipmap "ŻÓŁĆĘŚĄŹŃżółćęśąźń" "ZOLCESAZNzolcesazn")))
(import '(java.text Normalizer))
(defn unaccent [s]
(-> s
(java.text.Normalizer/normalize (java.text.Normalizer$Form/NFD))
(.replaceAll "[^\\p{ASCII}]", "")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment