There are multiple ways ^M can be caused
"^M" sometimes means (I dont know exactly what causes it) an ASCII (text) file was uploaded in binary mode - instead of ASCII. Always upload text files in ASCII. However, alot of web base upload scripts, frontpage, etc etc will f00k you up too and upload your text document in binary mode - yielding ^M characters.
If you are using "vi" text editor - you can remove the ^M from an entire text file (lets assume it has alot of lines) with the command:
:%s/^M//g
This is done by hitting the ":" key - then entering:
%s/CTRL+V CTRL+M//g
CTRL+V will give you the ^ in vi - and the CTRL+M will give you the M - for a complete - and correct ^M
Test it for yourself Create a simple text file - ftp it up to your favorite server in binary mode - whallah ^M
Common mistake.