Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 77
Registered: ‎11-20-2008
My Device: Not Specified

Special character restrictions for filenames

When saving a file onto the handset or media card, there seems to be a restriction on some special characters.  Does anyone know which special characters are allowed and disallowed?  I'm thinking about writing a scrubber to make sure my file names adhere to any restrictions.
Developer
Posts: 157
Registered: ‎05-10-2009
My Device: Not Specified

Re: Special character restrictions for filenames

I can't provide an exhaustive list but can say that ' does not work when loading a resource file .
Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: Special character restrictions for filenames

Bump.

 

Seriously, this needs to be documented.  I'm currently in a situation where I also need to know what characters are allowable in filenames.

Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: Special character restrictions for filenames

Okay, I just figured this one out experimentally.  I wrote a little bit of test code that iterated through the first 255 characters, capturing which ones did or didn't throw exceptions when used in a file name.

 

Here's the list of ones that throw exceptions:

[\u0000, \u0001, \u0002, \u0003, \u0004, \u0005, \u0006, \u0007, \b, \t, \n, \u000B, \f, \r, \u000E, \u000F, \u0010, \u0011, \u0012, \u0013, \u0014, \u0015, \u0016, \u0017, \u0018, \u0019, \u001A, \u001B, \u001C, \u001D, \u001E, \u001F, ", %, *, /, :, <, >, ?, \, |]