▲ | account42 2 days ago | |||||||
> Any competent language that uses UTF-8 for strings should already be returning errors when given such sequences. No they shouldn't because that's how you get file managers that can't manage files. | ||||||||
▲ | ninkendo 2 days ago | parent [-] | |||||||
The file manager wouldn’t use the “string” type to hold file names, if it’s written properly. Languages like Rust have things like OsString as separate from String for just this reason. If you have a type that says “my contents are valid UTF-8”, then you should reject invalid UTF-8 when populating it, obviously. Why would it work any other way? If you need a type that can hold arbitrary byte sequences, use a type that can hold arbitrary byte sequences. | ||||||||
|