korlibs-archive / korio

Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3
https://korlibs.soywiz.com/korio/
MIT License
361 stars 34 forks source link

Files with UTF8 are not supported on Windows. #136

Closed Kesanov closed 3 years ago

Kesanov commented 3 years ago

It isn't possible to open a file that contains UTF8 characters (e.g.ěščřžý áí) on Windows (JVM doesn't seem to have issue).

soywiz commented 3 years ago

Woops :) This might break people installing apps in folders with unicode characters then. It seems that we are using a plain fopen

https://github.com/korlibs/korio/blob/e1ae02896db858ba043caf26aa49347e58e9e31e/korio/src/nativeCommonMain/kotlin/com/soywiz/korio/file/std/LocalVfsNative.kt#L63

I have to check if there is an unicode version. I thought that maybe for cinterop Kotlin serialized to utf-8, but maybe fopen uses another locale? or even the locale defined by the computer?

Which locale, codepage is your computer using?

https://stackoverflow.com/questions/396567/is-there-a-standard-way-to-do-an-fopen-with-a-unicode-string-file-path