readText

suspend fun HttpResponse.readText(fallbackCharset: Charset? = null): String

Read the HttpResponse.content 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.features.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.