# File lib/marc/reader.rb, line 44
    def each 
      # while there is data left in the file
      while rec_length_s = @handle.read(5)
        # make sure the record length looks like an integer
        rec_length_i = rec_length_s.to_i
        if rec_length_i == 0
          raise MARC::Exception.new("invalid record length: #{rec_length_s}")
        end

        # get the raw MARC21 for a record back from the file
        # using the record length
        raw = rec_length_s + @handle.read(rec_length_i-5)
        
        # Ruby 1.9 will try to set the encoding to ASCII-8BIT, which we don't want.
        # Not entirely sure what happens for MARC-8 encoded records, but, technically,
        # ruby-marc doesn't support MARC-8, anyway.
        raw.force_encoding('utf-8') if raw.respond_to?(:force_encoding)

        # create a record from the data and return it
        #record = MARC::Record.new_from_marc(raw)
        record = MARC::Reader.decode(raw)
        yield record 
      end
    end