Cannot open files containing characters non ASCII range

I want to open a file that contains non ASCII range (Japanese) characters in the file name, but the behavior is different between Windows Simulator, Mac Simulator, and Playdate. If there is a good way to open the file in all environments, please let me know.

PDTest.zip (8.6 KB)

*Windows Simulator Log
File name appears to be Shift-JIS encoded.

== C File find (0あいう.txt)
filename byte: (30)(82)(a0)(82)(a2)(82)(a4)(2e)(74)(78)(74)
C listfiles Test Success.
C Open file Test Failed.
Lua listfiles Success. 
Lua Open file Failed.

*Playdate Device(Windows build) Log
File name appears to be Shift-JIS encoded.

<UTF8ERR>
filename byte: (30)(82)(a0)(82)(a2)(82)(a4)(2e)(54)(58)(54)
C listfiles Test Failed.
C Open file Test Failed.
Lua listfiles Failed. 
Lua Open file Failed.

*Mac simulator Log
File name appears to be UTF-16 encoded. I was able to open the file, but I am getting a warning, so there might be some problem.

warning: access to files is not allowed on the device
== C File find (0あいう.txt)
filename byte: (30)(e3)(81)(82)(e3)(81)(84)(e3)(81)(86)(2e)(74)(78)(74)
C listfiles Test Success.
C Open file Test Success.
warning: access to files is not allowed on the device
Lua listfiles Success. 
Lua Open file Success.

*Playdate Device(Mac build) Log
File name appears to be a short file name.

== C File find (0__~1.TXT)
filename byte: (30)(5f)(5f)(7e)(31)(2e)(54)(58)(54)
C listfiles Test Success.
C Open file Test Failed.
Lua listfiles Success. 
Lua Open file Failed.

When testing with the Playdate device, I had to mount it and delete the previous application files to get it to work properly.

1 Like

I've just finished up the migration to the new filesystem driver (includes journaling, should be a huge improvement) and confirmed that it does handle unicode filenames correctly. This will be in SDK 1.5 if all goes well, hopefully out soon(ish)!

4 Likes