module Addressable::IDNA

def self.unicode_compose(unpacked)

def self.unicode_compose(unpacked)
  unpacked_result = []
  length = unpacked.length
  return unpacked if length == 0
  starter = unpacked[0]
  starter_cc = lookup_unicode_combining_class(starter)
  starter_cc = 256 if starter_cc != 0
  for i in 1...length
    ch = unpacked[i]
    cc = lookup_unicode_combining_class(ch)
    if (starter_cc == 0 &&
        (composite = unicode_compose_pair(starter, ch)) != nil)
      starter = composite
      startercc = lookup_unicode_combining_class(composite)
    else
      unpacked_result << starter
      starter = ch
      startercc = cc
    end
  end
  unpacked_result << starter
  return unpacked_result
end