def build_marc_field!(error_handler, tag, indicators, text, authtext)

      # convert text and authtext from java bytes to a ruby
      # binary string.
      if text
        text = String.from_java_bytes(text)
        text.force_encoding("binary")
      end
      if authtext
        authtext = String.from_java_bytes(authtext)
        authtext.force_encoding("binary")
      end

      text = Traject::HorizonBibAuthMerge.new(tag, text, authtext).merge!

      return nil if text.nil? # sometimes there's nothing there, skip it.

      # convert from MARC8 to UTF8 if needed
      text = convert_text!(text, error_handler)

      if MARC::ControlField.control_tag?(tag)
        # control field
        return MARC::ControlField.new(tag, text )
      else
        # data field
        indicator1 = indicators.slice(0)
        indicator2 = indicators.slice(1)

        data_field = MARC::DataField.new(  tag,  indicator1, indicator2 )

        subfields  = text.split("\x1F")

        subfields.each do |subfield|
          next if subfield.empty?

          subfield_code = subfield.slice(0)
          subfield_text = subfield.slice(1, subfield.length)

          data_field.append MARC::Subfield.new(subfield_code, subfield_text)
        end
        return data_field
      end

    end
def build_marc_field!(error_handler, tag, indicators, text, authtext)

      # convert text and authtext from java bytes to a ruby
      # binary string.
      if text
        text = String.from_java_bytes(text)
        text.force_encoding("binary")
      end
      if authtext
        authtext = String.from_java_bytes(authtext)
        authtext.force_encoding("binary")
      end

      text = Traject::HorizonBibAuthMerge.new(tag, text, authtext).merge!

      return nil if text.nil? # sometimes there's nothing there, skip it.

      # convert from MARC8 to UTF8 if needed
      text = convert_text!(text, error_handler)

      if MARC::ControlField.control_tag?(tag)
        # control field
        return MARC::ControlField.new(tag, text )
      else
        # data field
        indicator1 = indicators.slice(0)
        indicator2 = indicators.slice(1)

        data_field = MARC::DataField.new(  tag,  indicator1, indicator2 )

        subfields  = text.split("\x1F")

        subfields.each do |subfield|
          next if subfield.empty?

          subfield_code = subfield.slice(0)
          subfield_text = subfield.slice(1, subfield.length)

          data_field.append MARC::Subfield.new(subfield_code, subfield_text)
        end
        return data_field
      end

    end
Returns a DataField or ControlField, can return
 nil if determined no field can/should be created.

 Do not call for field '0' (leader) or field 001,
 this doesn't handle those, will just return nil.

 First arg is a Marc4J ErrorHandler object, kind of a weird implementation
 detail.

 Other args are objects fetched from Horizon db via JDBC --
 text and authtext must be byte arrays.