Change encoding with Kotlin DSL

Hi,
I am migrating a java project from Groovy DSL (4.x) to Kotlin DSL (5.1.1).

What is the best way to change the encoding to “UTF-8”?

// old groovy code
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
javadoc.options.encoding = "UTF-8"
javadoc.options.addStringOption("charset", "UTF-8")

// new kotlin code
tasks {
    javadoc {
        options.encoding = "UTF-8"
    }
    compileJava {
        options.encoding = "UTF-8"
    }
    compileTestJava {
        options.encoding = "UTF-8"
    }
}

Is it possible to set the “encoding” only at one place?
Is it possible and necessary to set the “charset” option for Javadoc with Kotlin DSL? It is not available at “MinimalJavadocOptions.java”.

Thanks for any help.