From 100aeec3c65bb116da9c10cd6a315f606a846754 Mon Sep 17 00:00:00 2001 From: Holger Ludvigsen Date: Fri, 4 Oct 2019 13:27:45 +0200 Subject: [PATCH] jsonBody specifies character encoding utf-8 jsonBody should specify character encoding as utf-8. If it does not, the default encoding is ISO-8859-1 [1], which is problematic with foreign characters. [1] https://www.w3.org/International/articles/http-charset/index --- src/Http.elm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Http.elm b/src/Http.elm index 62dbf1a..afb2edd 100644 --- a/src/Http.elm +++ b/src/Http.elm @@ -227,11 +227,11 @@ emptyBody = {-| Put some JSON value in the body of your `Request`. This will automatically -add the `Content-Type: application/json` header. +add the `Content-Type: application/json;charset=utf-8` header. -} jsonBody : Encode.Value -> Body jsonBody value = - Elm.Kernel.Http.pair "application/json" (Encode.encode 0 value) + Elm.Kernel.Http.pair "application/json;charset=utf-8" (Encode.encode 0 value) {-| Put some string in the body of your `Request`. Defining `jsonBody` looks