01-11-2023, 10:15 PM
(01-11-2023, 09:52 PM)Spriggsy Wrote: Oh, that sounds horrible. Who on Earth would consider putting a pipe or slash in their filename? Makes escaping stuff much harder.
In practice you basically never see it because lots of programs won't like them, though for escaping on the shell it's not _too_ bad since you should be quoting your filenames anyway. But then some characters you might consider more "normal" (and are even allowed on Windows) can easily cause much bigger problems, such as dollar signs, so it is what it is. And of course filenames are typically some unicode format now, so that makes things even messier. In fact on Windows I don't believe filenames are even guaranteed to be _valid_ UTF-16, just a sequence of 2-byte pairs that look like UTF-16, you can put in any nonsense you want as long as it's not one of the few illegal characters. Generally speaking, the best way to handle filenames is to just treat them as an opaque sequence of bytes (besides the path separator) and never mess with them.
But case in point, if QB64 started automatically swapping backslashes for slashes then you could not open files on Linux that contain backslashes That kind of thing is why they're uncommon.