Kotlin, HTML-encoding without Android?

Viewed 201

I am using Android Studio, but for quick testing, I am executing a Kotlin function on my PC without Android. I want to HTML-encode some string, and searching Google showed only String.htmlEncode(), but that seems to be an extension method that use Android. Running "<b>".htmlEncode() on PC results in

Exception in thread "main" java.lang.NoClassDefFoundError: android/text/TextUtils

Is there a way to encode without Android? Or is there any way to import and use that Android TextUtils class on PC?

enter image description here

0 Answers
Related