We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a074058 commit ad5bd1bCopy full SHA for ad5bd1b
src/clj_http/client.clj
@@ -504,7 +504,7 @@
504
(defn detect-charset [content-type]
505
(or
506
(when-let [found (when content-type
507
- (re-find #"(?i)charset=(.*)" content-type))]
+ (re-find #"(?i)charset\s*=\s*([^\s]+)" content-type))]
508
(second found))
509
"UTF-8"))
510
test/clj_http/test/client.clj
@@ -651,4 +651,5 @@
651
(is (= "UTF-8"(client/detect-charset "text/html")))
652
(is (= "GBK"(client/detect-charset "application/json; charset=GBK")))
653
(is (= "ISO-8859-1" (client/detect-charset "application/json; charset=ISO-8859-1")))
654
+ (is (= "ISO-8859-1" (client/detect-charset "application/json; charset = ISO-8859-1")))
655
(is (= "GB2312" (client/detect-charset "text/html; Charset=GB2312"))))
0 commit comments