One of my users asked why my app does not support semi-colons in filenames. I stepped through my code, seems Windows function GetOpenFileName truncates any filename containing a semi-colon. e.g. "one;two.wav" -> "one".
Microsoft says colons are not allowed, but don't mention semi-colons...
http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
Are they legal or not?
EDIT: ..and how to GetOpenFileName() to work with semi-colons in filename?
OH!, Weird - Filename is correct, except 'scrolled' off to the left. So "one;two.wav" looks like "two.wav" until I click it and press left-arrow (then it's fine). So it's not a bug as such, only weird behaviour.
There are a few characters that simply aren't allowed in Windows filenames, the colon is one of them. Sorry. P.S. the full list of invalid characters is here: msdn.microsoft.com/en-us/library/windows/desktop/… It might be possible to do this with the native API or from a device driver.
Unfortunately, the Mac's HFS+ file system uses the COLON as a path separator just as Unix-like OSes use SOLIDUS / (slash) and Microsoft OSes use REVERSE SOLIDUS \ (backslash).
Semicolons are legal in NTFS file paths.
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)- Integer value zero, sometimes referred to as the ASCII NUL character.
- Characters whose integer representations are in the range from 1 through 31, except for alternate streams where these characters are allowed.
- Any other character that the target file system does not allow.
I'm able to add semicolons to filenames on my Win7 system. Watch for code, probably yours or third-party code, that does strange things with unexpected characters (most notably spaces).
Though it may be omitted in the Windows handbooks, the semicolon is a reserved character too, for example "dir .dat;.bak" is a legal command. The same applies to the plus character, for example "copy test1.dat+test2.dat test3.dat" is a legal command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With