toUtf8

Native
1.3
fun String.toUtf8(
    start: Int = 0,
    size: Int = this.length
): ByteArray

Converts a String into an UTF-8 array. Replaces invalid input sequences with a default character.