ring-clojure / ring-json

Ring middleware for handling JSON
316 stars 47 forks source link

Decode request body according to character-encoding #49

Closed liuchunhua closed 6 years ago

liuchunhua commented 7 years ago

when I post request include chinese word,param includes "??"

(defn- read-json [request & [{:keys [keywords? bigdecimals?]}]]
  (if (json-request? request)
    (if-let [body (:body request)]
      (let [body-string (slurp body)]
weavejester commented 7 years ago

It sounds like an encoding problem. The slurp should take the encoding from the request headers, or default to UTF-8.

A patch to fix this would be welcome.

liuchunhua commented 7 years ago

Ok,I pull a request.