in reply to Extra Character from telnet
I am not going to repeat what has been said before - the problem is obvious the difference between return/new line/etc between different OS's. It may be useful instead of trying to get rid of the offending character to build the regex to remove any non-allowable character from the user name & password. I know you didn't want to address security, but this may also help in people intentionally trying to put newlines in the middle by less reputable means than using an actual telnet client.