Windows (certainly 7) handles this perfectly well - try and type a character that isn't allowed in a file name and it pops up a tool tip saying it isn't allowed, along with a quick list of other characters that are disallowed. It also throws that key press away, so it doesn't have to be deleted and can't cause another kind of issue.
This is the difference between products which have undergone long rounds of user testing and ones that haven't. For me this is one of the biggest issues facing Linux based operating systems today, because this is generally not an itch that people working on the project feel like scratching (see: design, documentation, etc.) With commercially backed projects like Ubuntu, it can get there over time, but I would look at a user testing result summary like this and say "we have a LONG way to go" if it was a product that I was leading.