View on
Jarkko Hietaniemi > perl-5.7.3 > Unicode::Normalize



Annotate this POD

Module Version: 0.14   Source   Latest Release: perl-5.8.1


Unicode::Normalize - normalized forms of Unicode text


  use Unicode::Normalize;

  $string_NFD  = NFD($raw_string);  # Normalization Form D
  $string_NFC  = NFC($raw_string);  # Normalization Form C
  $string_NFKD = NFKD($raw_string); # Normalization Form KD
  $string_NFKC = NFKC($raw_string); # Normalization Form KC


  use Unicode::Normalize 'normalize';

  $string_NFD  = normalize('D',  $raw_string);  # Normalization Form D
  $string_NFC  = normalize('C',  $raw_string);  # Normalization Form C
  $string_NFKD = normalize('KD', $raw_string);  # Normalization Form KD
  $string_NFKC = normalize('KC', $raw_string);  # Normalization Form KC


Normalization Forms

$string_NFD = NFD($raw_string)

returns the Normalization Form D (formed by canonical decomposition).

$string_NFC = NFC($raw_string)

returns the Normalization Form C (formed by canonical decomposition followed by canonical composition).

$string_NFKD = NFKD($raw_string)

returns the Normalization Form KD (formed by compatibility decomposition).

$string_NFKC = NFKC($raw_string)

returns the Normalization Form KC (formed by compatibility decomposition followed by canonical composition).

$normalized_string = normalize($form_name, $raw_string)

As $form_name, one of the following names must be given.

  'C'  or 'NFC'  for Normalization Form C
  'D'  or 'NFD'  for Normalization Form D
  'KC' or 'NFKC' for Normalization Form KC
  'KD' or 'NFKD' for Normalization Form KD

Character Data

These functions are interface of character data used internally. If you want only to get Unicode normalization forms, you don't need call them yourself.

$canonical_decomposed = getCanon($codepoint)
$compatibility_decomposed = getCompat($codepoint)

If the character of the specified codepoint is canonically or compatibility decomposable (including Hangul Syllables), returns the completely decomposed string equivalent to it.

If it is not decomposable, returns undef.

$uv_composite = getComposite($uv_here, $uv_next)

If two characters here and next (as codepoints) are composable (including Hangul Jamo/Syllables and Exclusions), returns the codepoint of the composite.

If they are not composable, returns undef.

$combining_class = getCombinClass($codepoint)

Returns the combining class as integer of the character.

$is_exclusion = isExclusion($codepoint)

Returns a boolean whether the character of the specified codepoint is a composition exclusion.


NFC, NFD, NFKC, NFKD: by default.

normalize and other some functions: on request.


Unicode::Normalize has not been ported to EBCDIC. The code mostly would work just fine but a decision needs to be made: how the module should work in EBCDIC? Should the low 256 characters be understood as Unicode or as EBCDIC code points? Should one be chosen or should there be a way to do either? Or should such translation be left outside the module for the user to do, for example by using Encode::from_to()?


SADAHIRO Tomoyuki, <>

  Copyright(C) 2001-2002, SADAHIRO Tomoyuki. Japan. All rights reserved.

  This program is free software; you can redistribute it and/or 
  modify it under the same terms as Perl itself.


Unicode Normalization Forms - UAX #15

syntax highlighting: