support systems with no locale set, or locale set to "C" or "ANSI"
All UNIX systems treat filenames as bytes, while Windows always uses Unicode for filenames (UTF16 I think). This is entirely invisible if the machine where fdroidserver is set up with a unicode locale, e.g. export LANG=de_AT.UTF-8
. The problem comes when the base system is set to use a non-unicode locale, and then it has to work with filenames that include characters that are not in that locale. For example, if all of the localization environment variables are unset, e.g. ``, then the default locale becomes ASCII, and it cannot handle strings with non-ASCII characters. The same would apply if the system was using ISO8869-1 and there were files with Arabic or Chinese characters.
The solution to this is to always use bytes
for filenames when interacting with the filesystem. Unfortunately this can make the code pretty ugly.