Skip to content

Instantly share code, notes, and snippets.

@ibdknox
Created July 25, 2011 03:44
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 ibdknox/1103525 to your computer and use it in GitHub Desktop.
Save ibdknox/1103525 to your computer and use it in GitHub Desktop.
middleware
(server/add-middleware my-middleware)
(defn wrap-utf-8
"Adds the 'charset=utf-8' clause onto the content type declaration,
allowing pages to display all utf-8 characters."
[handler]
(fn [request]
(let [resp (handler request)
ct (get-in resp [:headers "Content-Type"])
neue-ct (str ct "; charset=utf-8")]
(assoc-in resp [:headers "Content-Type"] neue-ct))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment