| 1 | package SPVM::Unicode::Normalize; | ||
| 2 | |||
| 3 | 1 | our $VERSION = "0.011"; | |
| 4 | |||
| 5 | 1 | 1; | |
| 6 | |||
| 7 | =encoding utf8 | ||
| 8 | |||
| 9 | =head1 Name | ||
| 10 | |||
| 11 | SPVM::Unicode::Normalize - Normalizing UTF-8 | ||
| 12 | |||
| 13 | =head1 Description | ||
| 14 | |||
| 15 | Unicode::Normalize class in L<SPVM> normalizes UTF-8. | ||
| 16 | |||
| 17 | =head1 Usage | ||
| 18 | |||
| 19 | use Unicode::Normalize; | ||
| 20 | |||
| 21 | my $NFD_string = Unicode::Normalize->NFD($string); | ||
| 22 | |||
| 23 | my $NFC_string = Unicode::Normalize->NFC($string); | ||
| 24 | |||
| 25 | my $NFKD_string = Unicode::Normalize->NFKD($string); | ||
| 26 | |||
| 27 | my $NFKC_string = Unicode::Normalize->NFKC($string); | ||
| 28 | |||
| 29 | =head1 Class Methods | ||
| 30 | |||
| 31 | =head2 NFC | ||
| 32 | |||
| 33 | C<static method NFC : string ($string : string);> | ||
| 34 | |||
| 35 | Returns the Normalization Form C (formed by canonical decomposition followed by canonical composition). | ||
| 36 | |||
| 37 | This method calls native C<utf8proc_map> function defined in C<ut8proc.h> of L<utf8proc|SPVM::Resource::Utf8proc> library. | ||
| 38 | |||
| 39 | Exceptions: | ||
| 40 | |||
| 41 | The string $string must be defined. Otherwise an exception is thrown. | ||
| 42 | |||
| 43 | If utf8proc_map failed, an exception is thrown. | ||
| 44 | |||
| 45 | =head2 NFD | ||
| 46 | |||
| 47 | C<static method NFD : string ($string : string);> | ||
| 48 | |||
| 49 | Returns the Normalization Form D (formed by canonical decomposition). | ||
| 50 | |||
| 51 | This method calls native C<utf8proc_map> function defined in C<ut8proc.h> of L<utf8proc|SPVM::Resource::Utf8proc> library. | ||
| 52 | |||
| 53 | Exceptions: | ||
| 54 | |||
| 55 | The string $string must be defined. Otherwise an exception is thrown. | ||
| 56 | |||
| 57 | If utf8proc_map failed, an exception is thrown. | ||
| 58 | |||
| 59 | =head2 NFKC | ||
| 60 | |||
| 61 | C<static method NFKC : string ($string : string);> | ||
| 62 | |||
| 63 | Returns the Normalization Form KC (formed by compatibility decomposition followed by canonical composition). | ||
| 64 | |||
| 65 | This method calls native C<utf8proc_map> function defined in C<ut8proc.h> of L<utf8proc|SPVM::Resource::Utf8proc> library. | ||
| 66 | |||
| 67 | Exceptions: | ||
| 68 | |||
| 69 | The string $string must be defined. Otherwise an exception is thrown. | ||
| 70 | |||
| 71 | If utf8proc_map failed, an exception is thrown. | ||
| 72 | |||
| 73 | =head2 NFKD | ||
| 74 | |||
| 75 | C<static method NFKD : string ($string : string);> | ||
| 76 | |||
| 77 | Returns the Normalization Form KD (formed by compatibility decomposition). | ||
| 78 | |||
| 79 | This method calls native C<utf8proc_map> function defined in C<ut8proc.h> of L<utf8proc|SPVM::Resource::Utf8proc> library. | ||
| 80 | |||
| 81 | Exceptions: | ||
| 82 | |||
| 83 | The string $string must be defined. Otherwise an exception is thrown. | ||
| 84 | |||
| 85 | If utf8proc_map failed, an exception is thrown. | ||
| 86 | |||
| 87 | =head1 See Also | ||
| 88 | |||
| 89 | =over 2 | ||
| 90 | |||
| 91 | =item * L<Resource::Utf8proc|SPVM::Resource::Utf8proc> | ||
| 92 | |||
| 93 | =back | ||
| 94 | |||
| 95 | =head1 Porting | ||
| 96 | |||
| 97 | L<SPVM::Unicode::Normalize> is a Perl's L<Unicode::Normalize> porting to L<SPVM>. | ||
| 98 | |||
| 99 | =head1 Repository | ||
| 100 | |||
| 101 | L<SPVM::Unicode::Normalize - Github|https://github.com/yuki-kimoto/SPVM-Unicode-Normalize> | ||
| 102 | |||
| 103 | =head1 Author | ||
| 104 | |||
| 105 | Yuki Kimoto C<kimoto.yuki@gmail.com> | ||
| 106 | |||
| 107 | =head1 Copyright & License | ||
| 108 | |||
| 109 | Copyright (c) 2023 Yuki Kimoto | ||
| 110 | |||
| 111 | MIT License |