ajalt / clikt

Multiplatform command line interface parsing for Kotlin
https://ajalt.github.io/clikt/
Apache License 2.0
2.51k stars 121 forks source link

Kotlin-Native charset error on Windows #525

Closed tothlp closed 2 months ago

tothlp commented 2 months ago

I try reading an argument, like the following:

private val task by argument(help = "Name of the task")

When I use Hungarian accented characters like űáéúő on macOS and Linux, everything is fine. When I do the same on Windows, these characters are replaced by ?, or a rotated square with a question mark. I tried playing with the character encoding, but I found nothing, which is compatible with Kotlin Native.

ajalt commented 2 months ago

Is this an issue with Clikt? Did you try a plain println("űáéúő")?

tothlp commented 2 months ago

When I run println("űáéúő"), it prints well. As soon as I try to print the task argument, it prints the gibberish. I am not sure anymore, if that's an issue with Clikt, to be honest. But I have no other ideas. Can you maybe suggest, where to look next? Thanks!

tothlp commented 2 months ago

Also, if I simply print the arguments:

fun main(args: Array<String>) = App().main(args).also {
    println("args: ${args.joinToString()}")
}

It also prints the incorrect characters. Now I'm sure that is not an issue with Clikt. Happy for you, bad for me. :(

ajalt commented 2 months ago

Thanks for clarifying. I'll close this issue since it's not caused by clikt, but if you do find the solution, feel free to post it here for anyone who might encounter the same thing in the future.