MarsEdit Hint: Find Gremlins With BBEdit

I use a wonderful blog writing tool called MarsEdit. Occasionally I have run into the problem described below. Daniel has always been quick to reply directly to emails and I am pleased to see his detailed post on how to fix this annoying problem. (Or at least work around it.)

Find Gremlins With BBEdit

MarsEdit has a little shortcoming that can cause a vexing situation from time to time. It takes what you type or paste into it a bit too literally. So if you flub up at the keyboard and make some wacky keystrokes, you might end up with a weird “invisible character” in your blog post. What happens on most systems when you then go to publish, is you get a very unfortunate error message in return.

“Parse Error. Not well formed.” How lovely!

These tricky characters are especially sinister because you can almost never see them. When you end up with one of these bad boys in your post, the only hint you might get is if you are moving the cursor around with the arrow keys, you might see it “hiccup” a second while it stops on the invisible character.

I’m sure there are a lot of different names for these unwelcome guests in text, but I like the one the folks at Bare Bones use: “gremlins”. Their fine editor, BBEdit, has a dedicated tool just for rooting these suckers and either eliminating them or making them visible: Zap Gremlins.

I’d like to add something similar to MarsEdit, so I can spare users the pain of having to figure this out when run into an error dialog such as the one above. But in the meantime, I’ve been resorting to handling the customer support inquiries by myself taking the user’s example text into BBEdit and looking for gremlins. Then I can point out the location of the offending character to the user, they backspace it out of existence, and life goes on.

As relatively painless as BBEdit’s function makes the task, it’s not really perfectly suited to what I need. It’s more aimed at eliminating the beasts than examining them. Whereas I want as much information as I can get about them, so I can effectively communicate to the user (and also so I can catalog what types of characters users are running into trouble with).

Thanks to AppleScript support for the Zap Gremlins function, I was able to whip up a pretty handy script to streamline this operation. Find Gremlins takes the text contents of the clipboard, runs Zap Gremlins on it to find the gremlins, and then displays a summary of what it knows about them.

It gives me all the details I would normally have to work hard to figure out. What is the character? Where is it exactly, and most importantly of all, shows the character in context, replaced by a bullet for easy visibility. Although adding the text to a BBEdit document and manually examining the gremlins wasn’t too much of a time waster, it was still a bit boring and tedious.

I realize finding gremlins in the clipboard text will be useful to approximately 0% of you, but I thought it was a good opportunity to demonstrate how AppleScript support for the features of an application can turn out to serve incredibly particular needs. Thanks, Bare Bones! Zap Gremlins is saving me time, and helping me get my customers back to blogging in comfort.

(Via Red Sweater Blog.)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

One thought on “MarsEdit Hint: Find Gremlins With BBEdit”