News for hackers. Stuff that matters.
Re:Filenames and Pathnames in Shell: How to Do It Correctly by Someone on Tuesday June 20, 2023 @10:25AM (#36404452)
> Filenames should be created as the user typed it - don't change the input before storing it.

I wouldn’t go that far. Certainly, I would use some normalization algorithm on whatever the user typed, so that there’s no difference between typing a precomposed character (https://en.wikipedia.org/wiki/Precomposed_character) and typing a character and a combining character (https://en.wikipedia.org/wiki/Combining_character)

If you don’t do that, the user’s keyboard layout may affect whether they can type a given file name.

Also (nitpicking), if a user types a backspace or control-H, I wouldn’t include a 0x08 in the file name.

There are no comments on this comment yet.