any idea?
# ktor
c
any idea?
d
Is the encoding set correctly in the http header sent by the server?
e
Could you provide what the encoding information do you use?
d
Is the server ktor?
c
yes it's ktor
ok which header should I set?
I did it like this:
content-type: text/plain
post body:
2000:Neuchâtel
i get:
2000:Neuchâtel
d
yeah, but how do you set the header?
usually content-type have charset information
c
ah ok I just set it like I said, I didn't put any charset info
d
ie.: Content-Type: text/html; charset=utf-8
c
ah ok, then it's that
i try
yes it's that, thank u
😕
lol
sorry for bothering
d
This is the typed way for doing it:
response.header(HttpHeaders.ContentType, ContentType.Text.Plain.withCharset(Charsets.UTF_8).toString())
c
thanks
👍 1
d
In fact, there is a more concise way for it: https://ktor.io/servers/responses.html#properties
response.contentType(ContentType.Application.Json.withCharset(Charsets.UTF_8))
s
Default charset for json is utf8 so no need to specify that explicitly
1
📝 1
d
yeah, in this case this was plain/text, I just copied the sample, but going to change it too and say that for Json it is included