Encode unicode in JSON responses

To guard against package definitions and other things including unicode or
other characters.
This commit is contained in:
Christopher Baines 2025-04-27 11:11:31 +01:00
parent d00b539483
commit 36d34e03fc

View file

@ -169,11 +169,11 @@
(if stream? (if stream?
(lambda (port) (lambda (port)
(setvbuf port 'block (expt 2 16)) (setvbuf port 'block (expt 2 16))
(scm->json json port)) (scm->json json port #:unicode #t))
(call-with-encoded-output-string (call-with-encoded-output-string
"utf-8" "utf-8"
(lambda (port) (lambda (port)
(scm->json json port)))))) (scm->json json port #:unicode #t))))))
(define* (render-text text #:key (extra-headers '()) (define* (render-text text #:key (extra-headers '())
(code 200)) (code 200))