Detect BOM when getting blob as string

Fixed as suggested in #475