module UnicodeNormalize

def self.hangul_comp_one(string)

def self.hangul_comp_one(string)
  length = string.length
  if length>1 and 0 <= (lead =string[0].ord-LBASE) and lead  < LCOUNT and
                  0 <= (vowel=string[1].ord-VBASE) and vowel < VCOUNT
    lead_vowel = SBASE + (lead * VCOUNT + vowel) * TCOUNT
    if length>2 and 0 <= (trail=string[2].ord-TBASE) and trail < TCOUNT
      (lead_vowel + trail).chr(Encoding::UTF_8) + string[3..-1]
    else
      lead_vowel.chr(Encoding::UTF_8) + string[2..-1]
    end
  else
    string
  end
end