Use any character in the current code page for a name,including Unicode characters and characters in the extended character set (128–255),except for the following:
◦The following reserved characters:
<
(less than)>
(greater than):
(colon)"
(double quote)/
(forward slash)\
(backslash)|
(vertical bar or pipe)?
(question mark)*
(asterisk)
在.net中提供api以查找文件名中不允许的字符
char[] invalidFileChars = Path.GetInvalidFileNameChars();
Remarks
The array returned from this method is not guaranteed to contain the complete set of characters that are invalid in file and directory names. The full set of invalid characters can vary by file system. For example,on Windows-based desktop platforms,invalid path characters might include ASCII/Unicode characters 1 through 31,as well as quote (“),less than (<),greater than (>),pipe (|),backspace (\b),null (\0) and tab (\t).
但在备注部分,据说它取决于文件系统.
将此api用于基于Windows的操作系统如XP和Windows 7是否安全?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。