Skip to content

Instantly share code, notes, and snippets.

View zoren's full-sized avatar

Søren Sjørup zoren

  • Copenhagen, Denmark
View GitHub Profile
@zoren
zoren / gist:4eb9543395d743670154b7b10059e608
Last active June 19, 2020 09:09 — forked from biggert/gist:6453648
Get a clojure reader using the encoding by the BOM
(ns util
(:require [clojure.java.io :as io])
(:import org.apache.commons.io.input.BOMInputStream
org.apache.commons.io.ByteOrderMark))
(defn bom-reader
"Returns a BOM contextual reader with the proper encoding set (= BOM), defaults to UTF-8"
[input-stream]
(let [bom-array
(into-array [ByteOrderMark/UTF_16LE