Sunday, September 07, 2008

In the spirit of sharing.

A while ago I found I had an awful problem with exclamation points (or in Unix parlance bang or shebang) being inserted into my Blog entries at random locations. It would only happen on long Blog entries. It was maddening as I'd then have to go in and remove them by hand. It's been a problem for a number of years but I didn't know what to do to fix the problem. I tried searching for various iterations of Blogger and exclamation points but no such luck. One day, while researching another topic, I came across a message about Sendmail on a Mac (BSD) inserting exclamation points after around 2048 characters (2k bytes, hmm sounds familiar). It didn't say much more but I decided to revisit the problem and see if I couldn't fix it. First I discovered that Sendmail is actually adding a '!\n' (or exclamation point and a new line). Then I found out that it only exhibited this behavior if it hadn't received a '\r\n' (Carriage Return and New Line) within less than 2048 characters. My solution was when emailing my Blog entry to Blogger to use a Perl program I wrote that adds a '\r\n\' where the last white space would have been in a 2040 byte buffer. Yes, I made sure that every 2040 bytes there was a '\r\n'. There are other useful feature to the program that make it easy to use to write a Blog entry and mail it in. I've been using this fix for the last few months and it's worked really well. I've sent several entries that are well over 2048 bytes and I've seen no more '!'s in my Blogs. Hope this helps someone else. If you're interested in my Perl code it can be found send2blogger.pl.

Labels: ,

1 Comments:

At 9/26/2008 6:16 AM, Anonymous Anonymous said...

Your Blog has a great info on home automation through linux os.Best of Luck.

 

Post a Comment

<< Home