Skip to content

Commit

Permalink
Merge pull request #162 from bo-tato/decode-javascript
Browse files Browse the repository at this point in the history
decode application/javascript responses
  • Loading branch information
fukamachi authored Oct 29, 2023
2 parents 0c31422 + 5ba5a77 commit 051cbb7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/encoding.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 051cbb7

Please sign in to comment.