Skip to content

Commit ca7130c

Browse files
holgerlrupertlssmith
authored andcommitted
fixes elm#66
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
1 parent 34a9a27 commit ca7130c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Http.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ emptyBody =
227227

228228

229229
{-| Put some JSON value in the body of your `Request`. This will automatically
230-
add the `Content-Type: application/json` header.
230+
add the `Content-Type: application/json;charset=utf-8` header.
231231
-}
232232
jsonBody : Encode.Value -> Body
233233
jsonBody value =
234-
Elm.Kernel.Http.pair "application/json" (Encode.encode 0 value)
234+
Elm.Kernel.Http.pair "application/json;charset=utf-8" (Encode.encode 0 value)
235235

236236

237237
{-| Put some string in the body of your `Request`. Defining `jsonBody` looks

0 commit comments

Comments
 (0)