# File htree/encoder.rb, line 44
    def output_text(string)
      begin
        output_string string, @ic.iconv(string)
      rescue Iconv::IllegalSequence, Iconv::InvalidCharacter => e
        output_string string[0, string.length - e.failed.length], e.success
        unless @charpat =~ e.failed
          raise ArgumentError, "cannot extract first character"
        end
        char = $&
        rest = $'
        ucode = Iconv.conv("UTF-8", @internal_encoding, char).unpack("U")[0]
        output_string "&##{ucode};"
        string = rest
        retry
      end
    end