Skip to content

Commit

Permalink
Replace the form decoder with URLCodec
Browse files Browse the repository at this point in the history
- This addresses the following URLdecoding issue
ring-clojure/ring#269
  • Loading branch information
iku000888 committed Dec 7, 2016
1 parent 94a4647 commit 8794399
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ring/util/codec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
(:import java.io.File
java.util.Map
[java.net URLEncoder URLDecoder]
org.apache.commons.codec.binary.Base64))
org.apache.commons.codec.binary.Base64
org.apache.commons.codec.net.URLCodec))

(defn assoc-conj
"Associate a key with a value in a map. If the key already exists in the map,
Expand Down Expand Up @@ -112,7 +113,8 @@
or UTF-8 by default."
[^String encoded & [encoding]]
(try
(URLDecoder/decode encoded (or encoding "UTF-8"))
(let [codec (URLCodec. (or encoding "UTF-8"))]
(.decode codec encoded))
(catch Exception _ nil)))

(defn form-decode
Expand Down

0 comments on commit 8794399

Please sign in to comment.