What characters allowed in file names on Android?
On Android (at least by default) the file names encoded as UTF-8.
Looks like reserved file name characters depend on filesystem mounted (http://en.wikipedia.org/wiki/Filename).
I considered as reserved:
private static final String ReservedChars = "|\\?*<\":>+[]/'";
From android.os.FileUtils
private static boolean isValidFatFilenameChar(char c) {
if ((0x00 <= c && c <= 0x1f)) {
return false;
}
switch (c) {
case '"':
case '*':
case '/':
case ':':
case '<':
case '>':
case '?':
case '\\':
case '|':
case 0x7F:
return false;
default:
return true;
}
}
private static boolean isValidExtFilenameChar(char c) {
switch (c) {
case '\0':
case '/':
return false;
default:
return true;
}
}
Note: FileUtils are hidden APIs (not for apps; for AOSP usage). Use as a reference (or by reflection at one's own risk)