| 1 |
Unicode/Collate version 1.31 |
| 2 |
=============================== |
| 3 |
|
| 4 |
NAME |
| 5 |
|
| 6 |
Unicode::Collate - Unicode Collation Algorithm |
| 7 |
|
| 8 |
SYNOPSIS |
| 9 |
|
| 10 |
use Unicode::Collate; |
| 11 |
|
| 12 |
#construct |
| 13 |
$Collator = Unicode::Collate->new(%tailoring); |
| 14 |
|
| 15 |
#sort |
| 16 |
@sorted = $Collator->sort(@not_sorted); |
| 17 |
|
| 18 |
#compare |
| 19 |
$result = $Collator->cmp($a, $b); # returns 1, 0, or -1. |
| 20 |
$result = $Collator->eq($a, $b); # returns true/false |
| 21 |
(similarly ->ne, ->lt, ->le, ->gt, ->ge) |
| 22 |
|
| 23 |
Note: Strings in @not_sorted, $a and $b are interpreted |
| 24 |
according to Perl's Unicode support. See perlunicode, |
| 25 |
perluniintro, perlunitut, perlunifaq, utf8. |
| 26 |
Otherwise you can use "preprocess" or should decode them before. |
| 27 |
|
| 28 |
--- EBCDIC-SUPPORT IS EXPERIMENTAL. ---- |
| 29 |
|
| 30 |
INSTALL |
| 31 |
|
| 32 |
Perl 5.6.1 or later is required. |
| 33 |
Perl 5.8.1 or later is recommended. |
| 34 |
|
| 35 |
Though this distribution contains a subset of an old DUCET, named |
| 36 |
"keys.txt", this one is intended only for doing a test of this module |
| 37 |
and practically useless for any other purpose. |
| 38 |
|
| 39 |
Installation of Unicode::Collate::Locale requires Collate/Locale.pm, |
| 40 |
Collate/Locale/*.pm, Collate/CJK/*.pm and Collate/allkeys.txt. |
| 41 |
On building, Unicode::Collate::Locale doesn't require any of data/*.txt, |
| 42 |
gendata/*, and mklocale. |
| 43 |
Tests for Unicode::Collate::Locale are named t/loc_*.t. |
| 44 |
|
| 45 |
Since 0.54, XSUB that requires a C compiler will be built by default. |
| 46 |
To install this module type the following: |
| 47 |
|
| 48 |
perl Makefile.PL |
| 49 |
make |
| 50 |
make test |
| 51 |
make install |
| 52 |
|
| 53 |
Even if a C compiler is not available, pure Perl (i.e. non-XS) edition |
| 54 |
is available; type the following: |
| 55 |
|
| 56 |
perl disableXS |
| 57 |
perl Makefile.PL |
| 58 |
make |
| 59 |
make test |
| 60 |
make install |
| 61 |
|
| 62 |
If you decide to install XSUB edition after trying to build pure Perl, |
| 63 |
type the following: |
| 64 |
|
| 65 |
make clean |
| 66 |
perl enableXS |
| 67 |
perl Makefile.PL |
| 68 |
make |
| 69 |
make test |
| 70 |
make install |
| 71 |
|
| 72 |
DEPENDENCIES |
| 73 |
|
| 74 |
The conformant collation requires Unicode::Normalize (v 0.10 or later) |
| 75 |
although Unicode::Collate can be used without Unicode::Normalize. |
| 76 |
|
| 77 |
ABOUT DUCET |
| 78 |
|
| 79 |
Though this module can be used without any C<table> file, |
| 80 |
to use this module easily, it is recommended to install a table file |
| 81 |
in the UCA format, by copying it under the directory |
| 82 |
<a place in @INC>/Unicode/Collate. |
| 83 |
|
| 84 |
You can install such a table file by adding it to "Collate" directory |
| 85 |
(where "keys.txt" is placed) in this distribution before executing |
| 86 |
Makefile.PL. |
| 87 |
|
| 88 |
The most preferable one is "The Default Unicode Collation Element Table" |
| 89 |
(aka DUCET), available from the Unicode Consortium's website: |
| 90 |
|
| 91 |
http://www.unicode.org/Public/UCA/ |
| 92 |
|
| 93 |
http://www.unicode.org/Public/UCA/latest/allkeys.txt |
| 94 |
(latest version) |
| 95 |
|
| 96 |
If DUCET is not installed, it is recommended to copy the file |
| 97 |
from http://www.unicode.org/Public/UCA/latest/allkeys.txt |
| 98 |
to <a place in @INC>/Unicode/Collate/allkeys.txt manually. |
| 99 |
|
| 100 |
HOW TO CHANGE DUCET (NOT WARRANTED) |
| 101 |
|
| 102 |
0. rewriting UCA_Version and Base_Unicode_Version in Collate.pm |
| 103 |
and t/version.t is preferred. |
| 104 |
1. replace Collate/allkeys.txt with a new DUCET. |
| 105 |
2. run mklocale to generate new Locale/*.pl and Korean.pm. |
| 106 |
3. replace Collate/Locale/*.pl with the new Locale/*.pl, |
| 107 |
and Collate/CJK/Korean.pm with the new Korean.pm. |
| 108 |
4. make test. |
| 109 |
IF FAIL, it may require more changes, not be easy. |
| 110 |
|
| 111 |
AUTHOR, COPYRIGHT AND LICENSE |
| 112 |
|
| 113 |
The Unicode::Collate module for perl was written by SADAHIRO Tomoyuki, |
| 114 |
<[email protected]>. This module is Copyright(C) 2001-2021, |
| 115 |
SADAHIRO Tomoyuki. Japan. All rights reserved. |
| 116 |
|
| 117 |
This module is free software; you can redistribute it and/or |
| 118 |
modify it under the same terms as Perl itself. |
| 119 |
|
| 120 |
The file Unicode/Collate/allkeys.txt was copied verbatim |
| 121 |
from http://www.unicode.org/Public/UCA/13.0.0/allkeys.txt |
| 122 |
For this file, Copyright (c) 2020 Unicode, Inc. |
| 123 |
For terms of use, see http://www.unicode.org/terms_of_use.html |