From 87943990005add936f8d2cd0129eea631ff31f0c Mon Sep 17 00:00:00 2001 From: iku000888 Date: Wed, 7 Dec 2016 13:58:02 +0900 Subject: [PATCH] Replace the form decoder with URLCodec - This addresses the following URLdecoding issue https://github.com/ring-clojure/ring/issues/269 --- src/ring/util/codec.clj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ring/util/codec.clj b/src/ring/util/codec.clj index de57108..feed5c1 100644 --- a/src/ring/util/codec.clj +++ b/src/ring/util/codec.clj @@ -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, @@ -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