grassdog/klipbook — pull request #2 by brokensandals (2011-12-27 21:20:28+00:00)
Title: handle byte-order marks

I noticed the same book was sometimes appearing twice in a listing.

Apparently my 2nd-generation Kindle (sometimes?) put a byte-order mark at the front of the file. This was being picked up as part of the title for the first clipping (so that clipping's title would not be equal to the title on other clippings from the same book).

This could be stripped automatically by using File.open(..., 'r:bom|utf-8'). But this caused duplicates to appear from my Kindle Touch's clippings files... It looks like the Touch is adding byte-order marks before every single clipping, for some reason.

This commit just strips the UTF-8 byte order mark off of titles. Seems to work OK for me, don't know whether it's a good solution or not.