def normalize(input)
      input_length  = input.jlength
      in_ptr        = UCharPointer.from_string(input)
      needed_length = capacity = 0
      out_ptr       = UCharPointer.new(needed_length)

      retried = false
      begin
        Lib.check_error do |error|
          needed_length = Lib.unorm2_normalize(@instance, in_ptr, input_length, out_ptr, capacity, error)
        end
      rescue BufferOverflowError
        raise BufferOverflowError, "needed: #{needed_length}" if retried

        capacity = needed_length
        out_ptr = out_ptr.resized_to needed_length

        retried = true
        retry
      end

      out_ptr.string
    end
def normalize(input)
      input_length  = input.jlength
      in_ptr        = UCharPointer.from_string(input)
      needed_length = capacity = 0
      out_ptr       = UCharPointer.new(needed_length)

      retried = false
      begin
        Lib.check_error do |error|
          needed_length = Lib.unorm2_normalize(@instance, in_ptr, input_length, out_ptr, capacity, error)
        end
      rescue BufferOverflowError
        raise BufferOverflowError, "needed: #{needed_length}" if retried

        capacity = needed_length
        out_ptr = out_ptr.resized_to needed_length

        retried = true
        retry
      end

      out_ptr.string
    end
support for newer ICU normalization API