I had this problem since I switched from XEmacs to Emacs: when using tramp, filenames or buffer information all got a spurious trailing ^M. I have always worked around this problem, but today I decided it was enough.
This snippet in my .emacs file fixed it:
;; trying to get rid of those annoying ^M's in buffer names ;; and file names when using tramp ;; http://stackoverflow.com/q/2567600 (setq default-buffer-file-coding-system 'utf-8-unix) (prefer-coding-system 'utf-8)
Credits go to the people at StackOverflow