Reply To: How can I replace CR with CRLF?

Product Compare Forums Multi-Edit Support How can I replace CR with CRLF? Reply To: How can I replace CR with CRLF?

#4555
ReidSweatman
Participant

Multi-Edit looks at your file when it opens it and makes a best-guess as to the file type based on the frequency of particular line terminators. In this instance, I’d venture to guess that if it’s opening your file as a PC file, when in fact it’s a Mac file, there are probably some lines close to the top terminated PC-style, i.e., \r\n, instead of the Mac standard of \r (for the record, and in the interest of completeness, UNIX\Linux uses \n for line termination.

Before 9.10, Multi-Edit simply assumed its best guess, and actually converted the rest of the file to that format on save. 9.10 preserves whatever terminators may be in the file, as there are some legitimate reasons for files with mixed terminators. It will still try to make the determination when you open the file, though, since it has to assume something in order to continue. If it’s consistently guessing wrong, do as John suggests and override the file type in the Open File dialog, then look for any offending terminators that may be left over; they’ll generally show up as square boxes (Windows’s default for characters it can’t display in the current font). If it won’t compromise the behavior of some other program that has to work with the file, just delete the offending symbols (this assumes you really want the file to be a Mac file).

Multi-Edit removes line terminators when it loads a file, only storing information about what kind of termination a line had, so that it can restore it when you save the file again. If you’re seeing squares at line ends, that’s a pretty good sign you have mixed line terminators in the file. If you can live with that, no problem; if not, you probably want to force the file to one or another of the possible platform standards (note that opening as a particular type and then saving won’t do this).

If you want direct access to line terminators, open the file in binary mode (again, note that this is not the same as opening it as any kind of text file, then switching it to hex mode (Text | Hex mode from the main menu); the latter merely changes how Multi-Edit\ displays the file, not what its contents are. But if you open it in binary mode to begin with, Multi-Edit doesn’t try to interpret the file contents in any way; it simply loads everything into memory, including the line terminators. This takes a bit of getting used to to read, but you can still search either pane of the opened file (it will open in two panes, purely as an aid to visualization; you can edit in either pane and the changes will occur in both).

With the file open in binary mode, you can search and replace (I’d suggest doing this on a copy until you’re sure you haven’t inadvertently hashed the file) on the line terminators, or any other character. Once more, for the record, the three platforms use the following terminating characters:[list:246siybw][*:246siybw] DOS/Windows \r\n or 0x0D0A[/*:m:246siybw][*:246siybw] Macintosh \r or 0x0D[/*:m:246siybw][*:246siybw] UNIX\Linux \n or 0x0A[/*:m:246siybw][/list:u:246siybw]Once you’ve done your search and replace, save the file and try reopening it in default mode; if you’ve done everything right, it should look fine.