In many cases a user may simply copy and paste a title or long sentence as a path. Instead of forcing the user to remove the illegal characters, it would be better to replace automatically such characters with underscores. This is the default behavior of MediaWiki and it is really useful.