Invalid characters in Item and SO ids

We are running into issues where a user copies a part ID from an excel sheet only to get a space at the end of the item ID or SO tranno.  Sage support didn't have a good suggestion to keep this from happening. 

Has anyone else run into this?  If so what methods did you employ to fix the issue?  Also Were you able to do something to filter the input to keep it from happening again?  I'm thinking about creating an on save script that would validate data before allowing you to save but I'm amazed the functionality isn't baked in. We are running Sage 500 2014.