How to deal with german Umlauts in file names?

In my Android app I use audio files like “präsens.mp3”:
soundHandle = audio.loadSound( “präsens.mp3” )

When I run the app in the simulator (on a MacBook) it issues this warning:
“WARNING: sound.lua:251: the file ‘präsens.mp3’ could not be found at case-sensitive path ‘präsens.mp3’
found filename with different case ‘pr√§sens.mp3’”

Despite of the warning, the file is found and played, but for me this seems to be good luck. I would not bet my life on it, that this works fine on every Android phone.

How to use the file name with Umlauts in a correct and clean way, so no warning is issued?

When it says: “could not be found at case-sensitive path”, It means that the file could be found only because your hard-drive volume is NOT case-sensitive. So there is no difference between “AUDIO.mp3” and “audio.mp3”, Solar2D is going to play it anyways.

Now, Android IS case-sensitive, so it is going to throw you an error instead of that warning.

I would recommend you to name your files avoiding those special characters. And if possible, create a case-sensitive volume in your Mac, so you will not have any surprises on Android regarding wrong case-sensitive paths.

If you want a quick fix, just use audio.loadSound("präsens.mp3").

1 Like

Thanks depilz. I’ve looked it up and yes, my Mac’s file system is APFS (case insensitive).

What I don’t understand is, that the file is named “präsens.mp3” in the file system and in Solar2D/LUA I use the string “präsens.mp3” too. Exactly the same, so both are lowercase. Also the Umlaut is lowercase (upper case would be “PRÄSENS.MP3”).
So why does Solar2D moan about it then?

Like @depilz already hinted at, the best advice is to simply not deal with them.

You should stick to using only alphanumeric ascii characters for variable and file names. There could be any number of issues related to this and since they can’t all be accounted for, they should just be avoided altogether.

1 Like