diff options
author | Norbert Preining <norbert@preining.info> | 2024-03-15 03:06:35 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-03-15 03:06:35 +0000 |
commit | 12679ab7d3c2a210f4123163671b532b8b55d5f9 (patch) | |
tree | 0060d13467186ad977f4e73488ee20dd6c0017ab /systems/texlive/tlnet/tlpkg/tlperl/lib/Unicode/Collate.pm | |
parent | 62170822e034fdd3f81de7274835d0d3b0467100 (diff) |
CTAN sync 202403150306
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/Unicode/Collate.pm')
-rw-r--r-- | systems/texlive/tlnet/tlpkg/tlperl/lib/Unicode/Collate.pm | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Unicode/Collate.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Unicode/Collate.pm index e57cdf8d6e..7b8e547073 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Unicode/Collate.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Unicode/Collate.pm @@ -1,14 +1,5 @@ package Unicode::Collate; -BEGIN { - unless ("A" eq pack('U', 0x41)) { - die "Unicode::Collate cannot stringify a Unicode code point\n"; - } - unless (0x41 == unpack('U', 'A')) { - die "Unicode::Collate cannot get a Unicode code point\n"; - } -} - use 5.006; use strict; use warnings; @@ -17,7 +8,7 @@ use File::Spec; no warnings 'utf8'; -our $VERSION = '1.29'; +our $VERSION = '1.31'; our $PACKAGE = __PACKAGE__; ### begin XS only ### @@ -94,13 +85,24 @@ sub Base_Unicode_Version { '13.0.0' } ###### +my $native_to_unicode = ($::IS_ASCII || $] < 5.008) + ? sub { return shift } + : sub { utf8::native_to_unicode(shift) }; + +my $unicode_to_native = ($::IS_ASCII || $] < 5.008) + ? sub { return shift } + : sub { utf8::unicode_to_native(shift) }; + +# pack_U() should get Unicode code points. sub pack_U { - return pack('U*', @_); + return pack('U*', map $unicode_to_native->($_), @_); } +# unpack_U() should return Unicode code points. sub unpack_U { - return unpack('U*', shift(@_).pack('U*')); + return map $native_to_unicode->($_), unpack('U*', shift(@_).pack('U*')); } +# for older perl version, pack('U*') generates empty string with utf8 flag. ###### @@ -2101,12 +2103,14 @@ C<variable =E<gt> "non-ignorable", level =E<gt> 3)> should be used. B<Unicode::Normalize is required to try The Conformance Test.> +B<EBCDIC-SUPPORT IS EXPERIMENTAL.> + =back =head1 AUTHOR, COPYRIGHT AND LICENSE The Unicode::Collate module for perl was written by SADAHIRO Tomoyuki, -<SADAHIRO@cpan.org>. This module is Copyright(C) 2001-2020, +<SADAHIRO@cpan.org>. This module is Copyright(C) 2001-2021, SADAHIRO Tomoyuki. Japan. All rights reserved. This module is free software; you can redistribute it and/or |