Backslash versus foreslash
#14
(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 Tongue That kind of thing is why they're uncommon.
Reply


Messages In This Thread
Backslash versus foreslash - by TerryRitchie - 01-10-2023, 05:40 PM
RE: Backslash versus foreslash - by SMcNeill - 01-10-2023, 06:21 PM
RE: Backslash versus foreslash - by mnrvovrfc - 01-10-2023, 06:34 PM
RE: Backslash versus foreslash - by Fifi - 01-11-2023, 05:20 AM
RE: Backslash versus foreslash - by SMcNeill - 01-10-2023, 06:43 PM
RE: Backslash versus foreslash - by TerryRitchie - 01-10-2023, 06:50 PM
RE: Backslash versus foreslash - by SMcNeill - 01-10-2023, 06:54 PM
RE: Backslash versus foreslash - by TerryRitchie - 01-10-2023, 07:17 PM
RE: Backslash versus foreslash - by mdijkens - 01-11-2023, 08:24 AM
RE: Backslash versus foreslash - by DSMan195276 - 01-11-2023, 09:38 PM
RE: Backslash versus foreslash - by DSMan195276 - 01-11-2023, 10:15 PM
RE: Backslash versus foreslash - by mnrvovrfc - 01-12-2023, 02:12 AM
RE: Backslash versus foreslash - by TerryRitchie - 01-12-2023, 05:16 AM
RE: Backslash versus foreslash - by Fifi - 01-14-2023, 07:59 AM
RE: Backslash versus foreslash - by TerryRitchie - 01-16-2023, 03:53 AM



Users browsing this thread: 3 Guest(s)