Illegal Filename Characters?

Community Forums/General Help/Illegal Filename Characters?

Chalky(Posted 2009) [#1]
I am writing a Load/Save As... file requestor which uses a textbox for filename input. Other than "\" and "/" is there an industry-standard list of illegal filename characters?


xlsior(Posted 2009) [#2]
I am writing a Load/Save As... file requestor which uses a textbox for filename input. Other than "\" and "/" is there an industry-standard list of illegal filename characters?


On Windows: < > : " / \ | ? *

Of course, / : and \ are valid when they are part of the path itself (e.g. C:\folder\file.txt or C:/folder/file.txt

Now, there are some other restrictions: You cannot name a file the same as a reserved devicename, which means that the following file/folder names are also out of the question:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9
It's also recommended not to use any of those + extension, so COM1.TXT is not OK either.

(The reason for this is that those devices are accessed by the PC as if they were files: So with a parallel printer, you can use your standard open file commands, use "LPT1" for the filename, and any information written to the 'file' is automatically redirected and printed out for you. Kind of outdated now, but windows still treats these as reserved names and will not let you create them on disk)

You also -may- run into problems with certain ASCII characters, like characters 128-255 and 0,7,8,10,13 in your filenames on some systems - not all programs can handle them.


Chalky(Posted 2009) [#3]
That's great xlsior - many thanks :o)


Brucey(Posted 2009) [#4]
And remember that the character codes 256 - 65535 are also valid :-)


xlsior(Posted 2009) [#5]
And remember that the character codes 256 - 65535 are also valid :-)


Ah yes -- that's the range for unicode characters, which are used to represent special characters that don't fit in the 'normal' Latin alphabet, like Japanese, Arabic, Hebrew, etc.