windows - Safe/Allowed filename cleaner for .NET -


Whether to take an arbitrary string in .NET in a standardized / librid / tested way and to confuse it in such a way that Does it represent a valid filename?

It is easy to roll your own four-replacement function, but I should make a little more strong and revive.

This problem is not as simple as you think it is. Not only are these that are eligible in path.GetInvalidFileNameChars , there are many filenames, such as "PRN" and "Conn", which are reserved by Windows and can not be made. Any name that is "." Besides, there is also illegal in Windows, there are different length limitations. Read the complete list.

If that is not enough, different file systems have different limitations, for example the ISO9660 filename can not start with "-", but it may be included.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -