Tool for looking for cr and lf (\r and \n) characters

Just for the record (I can’t imagine that this is a major issue for many people!):

It would be useful to have some way of finding and/or editing the invisible characters you get in text-editing windows. I had a problem (viewtopic.php?f=2&t=4590) with \n and \r being invisible and treated identically in Scrivener but causing problems when output… Workrounds (post-processing) are easy but they make the workflow untidy. It took some time to track the little blighters down … :slight_smile:

It would be nice to have a few options on the Find/Replace dialog for finding these characters…

There are probably a number of other ways that you could address/solve/avoid this issue, but most would probably be more work: convert on input; convert on output; show invisible characters, etc… An AppleScript solution would be OK if AppleScript was able to get access to the text at that level of detail.

But - for now - anyone who has problems with line endings will be able to search the forum and find this post.

Scrivener is not currently Applescriptable, but you can tackle problems like these by writing an Applescript that operates on textual content on OS X’s clipboard–assuming the problem you were encountering is regular enough that you might need to chase this sort of thing down often enough to make is worth the time to write the script.

Then, processing a document’s text is as easy as a select-all and copy from the document, invoking the script, then pasting back into the document.

I have some processes that I achieve this way with Scrivener.

–Greg

I’ll post a reply here and link to this post in case others are looking for workarounds too. The creators of DevonThink and all things Devon have a service which can convert text to Mac, Unix and Windows line endings. WordService can also remove line endings, multiple line endings, spaces, sort ascending and descending and more.

Thanks! There are of course lots of workrounds, and it’s good to document as many as we can, so that a suitable one exists for each us.

I suppose the point of me posting here was just that in an ideal world the problem would either be prevented from occurring in the first place or easily fixable without requiring an extra step into the workflow. And to record the problem too…

thanks all