I'm writing an application for Linux and Windows h...
# kotlin-native
e
I'm writing an application for Linux and Windows hosts. It has to process files and directories that can often contain various japanese, korean, etc. UTF-8 characters in their names. Everything works fine on Linux, however on Windows they are never processed or displayed correctly, what leads to incorrect and broken paths.
toKString()
function returns correct values on Linux, and broken ones on Windows, I'm assuming because of some Windows or mingw encoding-related caveat that I can't figure out. I created a simple project to demonstrate the issue, does anyone know how to deal with this? https://gitlab.com/Chazoshtare/encoding-issue-kn/-/tree/master
e
I don't use Windows so I don't know if this works, but can you set your app to run with the UTF-8 "codepage"? https://docs.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
e
This seems like a workaround, but it works. Thank you!
n
Note that Windows isn't POSIX compliant. I don't use Windows, but the platform from what I have heard has the Win32 API which covers file IO ( https://docs.microsoft.com/en-us/windows/win32/fileio/opening-a-file-for-reading-or-writing ). POSIX uses the UTF-8 encoding, which many Unix based OS's use (eg Linux).
The code base contains some hard coded strings, which will likely cause character encoding issues (you are dealing with two different platforms which don't use the same character encoding). Have you looked at moving the strings into a separate text file?