Response Character Encoding

Viewed 22

How can I explicitly set the character encoding (e.g. UTF-8) in a response?

call.respondText("Hello World!", ContentType.Text.Plain, HttpStatusCode.OK)
1 Answers

You can call the withCharset method on a ContentType object to create a copy with specified charset:

call.respondText("Hello World!", ContentType.Text.Plain.withCharset(Charsets.UTF_8), HttpStatusCode.OK)
Related