Idk, I don't think silently removing whitespace in the middle of the text is appropriate (though beginning and end should be stripped), but the form should warm you when there's obviously invalid input.
Silently "correcting" input can be really annoying. For example, my SO's first name has multiple capitals, and some forms "helpfully" split it into two words and the first name gets cut. If I know that, I can spell it without the capitals, but sometimes it doesn't let me know and I need to call in to get it fixed.