bodyAsText

suspend fun HttpResponse.bodyAsText(fallbackCharset: Charset = Charsets.UTF_8): String

Reads the HttpResponse.rawContent as a String. You can pass an optional charset to specify a charset in the case no one is specified as part of the Content-Type response. If no charset specified either as parameter or as part of the response, io.ktor.client.plugins.HttpPlainText settings will be used.

Note that fallbackCharset parameter will be ignored if the response already has a charset. So it just acts as a fallback, honoring the server preference.