encode

fun CharsetEncoder.encode(input: CharSequence, fromIndex: Int = 0, toIndex: Int = input.length): ByteReadPacket
fun CharsetEncoder.encode(input: CharArray, fromIndex: Int, toIndex: Int, dst: Output)


fun CharsetEncoder.encode(input: CharSequence, fromIndex: Int, toIndex: Int, dst: Output)

Deprecated (with error)

Use writeText on Output instead.

Replace with

import io.ktor.utils.io.core.writeText
dst.writeText(input, fromIndex, toIndex, charset)