views:

237

answers:

2

What special characters are allowed for file names on Android?

~!@#$%^&*()_+/\.,

Also, can I save file with Unicode name?

A: 

If you try to add a file to the res directory in an Android project you get the following message:

res/drawable/test-1.xml: Invalid file name: must contain only [a-z0-9_.]

I'm guessing however that this only applies to files inside the .apk file.

Jay Askren
A: 
  1. On Android (at least by default) the file names encoded as UTF-8.

  2. 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 = "|\\?*<\":>+[]/'";
alex2k8