At the moment, I have a process buffer that utf-8-auto(emacs modeline tells the buffer as utf-8-auto-dos) with CRLFnew characters. When I write multiline text to the buffer through process-send-regionor process-send-string, each line is placed in ^M.
What makes this problem odd is that the text written to process-buffer directly from the process does not contain ^M.
It does not seem to matter where the source text comes from, and even a multi-line region marked and sent, which is already present in the process buffer (which does not contain ^M), will have them when sending.
( Note the source code for the send process area will always come from the Emacs buffer, process-send-string when the multi-line will be from the Windows clipboard interface to killring, or again from the Emacs buffer to kill.)
I should also add that the input text to the buffer is parsed using after-change-functionshook (to do some coloring based on input), so the last thing I will do is add extra regexp-replace-in-stringfor this incoming text as part of this hook function, I would like to avoid this because it is It seems wrong, but I will add it as a hacker solution if nothing works.
Adding
I updated the encoding settings for the buffer, and the process used utf-8-dosinstead utf-8-auto, but ^Mdisappeared.
, ...
(switch-to-buffer "sock-buffer")
(set-process-coding-system (get-process sock-process) 'utf-8-dos 'utf-8-dos)
(set-buffer-file-coding-system 'utf-8-dos nil)
(set-buffer-process-coding-system 'utf-8-dos 'utf-8-dos)
...
(switch-to-buffer "sock-buffer")
(set-buffer-process-coding-system 'utf-8-dos 'utf-8-dos)
.