@@ 48,7 48,7 @@ Options:
(def some-spaces (peg/compile ~(some :s)))
(def utf8-pattern (peg/compile
~{:main (sequence :charset '(to "?=") "?=")
- :charset (sequence "=?" (+ "UTF" "utf") "-8?" '(set "BQ") "?")}))
+ :charset (sequence "=?" (+ "UTF" "utf") "-8?" '(set "bqBQ") "?")}))
(def iso-8859-q-pattern (peg/compile
~{:main (sequence :charset '(to "?=") "?=")
:iso (sequence (+ "ISO" "iso") "-8859-1" (? "5"))
@@ 195,7 195,8 @@ Options:
(defn decode-utf8 [line]
# TODO: might result in `Doe, John <john@doe.net>` → needs double quotes
(string (peg/replace-all utf8-pattern
- (fn [_ type_ bytes] (if (= type_ "B")
+ (fn [_ type_ bytes] (if (or (= type_ "B")
+ (= type_ "b"))
(base64/decode bytes)
(replace-utf8 bytes))) line)))