From 5ba5a770e1834e060c8441a1ebf3ceb9c32b3e7a Mon Sep 17 00:00:00 2001 From: bo-tato <122528427+bo-tato@users.noreply.github.com> Date: Fri, 13 Oct 2023 22:53:36 +0000 Subject: [PATCH] decode application/javascript responses --- src/encoding.lisp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/encoding.lisp b/src/encoding.lisp index e1bb473..4780508 100644 --- a/src/encoding.lisp +++ b/src/encoding.lisp @@ -50,11 +50,17 @@ nil) :utf-8)) ((and (string-equal type "application") - (string-equal subtype "json")) + (or (string-equal subtype "json") + (string-equal subtype "javascript"))) ;; According to RFC4627 (http://www.ietf.org/rfc/rfc4627.txt), ;; JSON text SHALL be encoded in Unicode. The default encoding is UTF-8. ;; It's possible to determine if the encoding is UTF-16 or UTF-36 ;; by looking at the first four octets, however, I leave it to the future. + ;; + ;; According to RFC4329 (https://datatracker.ietf.org/doc/html/rfc4329), + ;; javascript also is specified by charset, or defaults to UTF-8 + ;; It's also possible to specify in the first four octets, but + ;; like application/json I leave it to the future. (charset-to-encoding charset :utf-8)) ((and (string-equal type "application") (ppcre:scan "(?:[^+]+\\+)?xml" subtype))