From 29f5d8aa67c7b567c50021faa41e1a0cbcf30188 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 12 Aug 2024 11:24:03 +0200 Subject: [PATCH] Specify utf-8 as default form encoding This makes it possible to parse non-ascii characters in form fields. --- cask/src/cask/endpoints/FormEndpoint.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cask/src/cask/endpoints/FormEndpoint.scala b/cask/src/cask/endpoints/FormEndpoint.scala index 956e09130b..3f80ba1a7f 100644 --- a/cask/src/cask/endpoints/FormEndpoint.scala +++ b/cask/src/cask/endpoints/FormEndpoint.scala @@ -55,7 +55,10 @@ class postForm(val path: String, override val subpath: Boolean = false) def wrapFunction(ctx: Request, delegate: Delegate): Result[Response.Raw] = { try { - val formData = FormParserFactory.builder().build().createParser(ctx.exchange).parseBlocking() + val formData = FormParserFactory + .builder().withDefaultCharset("utf-8").build() + .createParser(ctx.exchange) + .parseBlocking() delegate( formData .iterator()