How to remove ^M (extra carriage return)

Help with writing and playing macros

How to remove ^M (extra carriage return)

Postby Babalou » Wed Nov 01, 2006 4:25 pm

I am looking for a macro that would remove the ^M added when you transfered a text file as Binary from a UNIX machine to a Windows desktop.
Thanks!
User avatar
Babalou
Newbie
 
Posts: 1
Joined: Wed Nov 01, 2006 12:00 am

Re: How to remove ^M (extra carriage return)

Postby Mofi » Wed Nov 01, 2006 5:57 pm

You hopefully know the difference between UNIX (only line-feed = LF = 0A) and DOS (carriage return + line-feed = CRLF = 0D 0A) line termination.

You hopefully also know what is the difference between a binary and a text FTP transfer. Text is CR LF to LF from Windows to Unix and LF to CR LF from Unix to Windows. Binary is without any modification.

And you hopefully know the DOS/UNIX/MAC Handling configuration settings of UltraEdit.

In UltraEdit in View - ASCII Table you can see that ^M is the control character for carriage return CR.

So either your text files have already an invalid line termination something like CR CR LF (use hex mode of UltraEdit to see it) or you make something completely wrong. CR CR LF for example is created when saving a file in DOS format and transfer it in binary mode to the Unix machine but load it from the Unix machine in text mode.

See section My suggestions for the configuration for UTF-8 webpage writers at Using UTF-8 with UltraEdit.

And use forum search with search option Search for all terms which and the words because I have written already how to fix wrong line terminations with a Replace or a Replace In Files (see also help of Replace command).
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros