diff options
author | Karl Williamson <public@khwilliamson.com> | 2010-11-16 18:29:07 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-11-18 12:58:24 -0800 |
commit | 3ffed8c228f4a59b1527ae7ed584ca21386420f7 (patch) | |
tree | abe795b4e26ba415655c14802e70207603d88300 /lib | |
parent | 6efce82dbb7230a1ac8fdcd073e50b4c2858d669 (diff) | |
download | perl-3ffed8c228f4a59b1527ae7ed584ca21386420f7.tar.gz |
Work-around Uni 6.0 issues with 'BELL'
Unicode version 6.0 has co-opted the name BELL for a different character
than traditionally used in Perl. This patch works around that by adding
ALERT as a synonym for BELL, and causing a deprecated warning for uses
of the old name.
The new Unicode character will be nameless in Perl 5.14, unless I can
(unlikely) get Unicode to grant a synonym that they will support.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charnames.pm | 7 | ||||
-rw-r--r-- | lib/charnames.t | 11 | ||||
-rw-r--r-- | lib/unicore/mktables | 29 |
3 files changed, 44 insertions, 3 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm index 677edfc6a5..750b1cf3d3 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -2,7 +2,7 @@ package charnames; use strict; use warnings; use File::Spec; -our $VERSION = '1.16'; +our $VERSION = '1.17'; use bytes (); # for $bytes::hint_bits @@ -35,7 +35,7 @@ my %system_aliases = ( 'EOT' => pack("U", 0x04), # END OF TRANSMISSION 'ENQ' => pack("U", 0x05), # ENQUIRY 'ACK' => pack("U", 0x06), # ACKNOWLEDGE - 'BEL' => pack("U", 0x07), # BELL + 'BEL' => pack("U", 0x07), # ALERT; formerly BELL 'BS' => pack("U", 0x08), # BACKSPACE 'HT' => pack("U", 0x09), # HORIZONTAL TABULATION 'LF' => pack("U", 0x0A), # LINE FEED (LF) @@ -401,6 +401,9 @@ my %deprecated_aliases = ( 'PARTIAL LINE UP' => pack("U", 0x8C), # PARTIAL LINE BACKWARD 'VERTICAL TABULATION SET' => pack("U", 0x8A), # LINE TABULATION SET 'REVERSE INDEX' => pack("U", 0x8D), # REVERSE LINE FEED + + # Unicode 6.0 co-opted this for U+1F514, so deprecate it for now. + 'BELL' => pack("U", 0x07), ); diff --git a/lib/charnames.t b/lib/charnames.t index 46f206ac4d..f44c8059b9 100644 --- a/lib/charnames.t +++ b/lib/charnames.t @@ -249,6 +249,11 @@ is("\N{BOM}", chr(0xFEFF)); ok(grep { /"HORIZONTAL TABULATION" is deprecated.*CHARACTER TABULATION/ } @WARN); + # XXX These tests should be changed for 5.16, when we convert BELL to the + # Unicode version. + is("\N{BELL}", "\a"); + ok((grep{ /"BELL" is deprecated.*ALERT/ } @WARN), 'BELL is deprecated'); + no warnings 'deprecated'; is("\N{VERTICAL TABULATION}", "\013"); @@ -914,6 +919,12 @@ is("\N{U+1D0C5}", "\N{BYZANTINE MUSICAL SYMBOL FTHORA SKLIRON CHROMA VASIS}"); # marked <control> $name = $u1name if $name eq "<control>"; + $name = 'ALERT' if $decimal == 7; + + # XXX This test should be changed for 5.16 when we convert to use + # Unicode's BELL + $name = "" if $decimal == 0x1F514; + # Some don't have names, leave those array elements undefined next unless $name; diff --git a/lib/unicore/mktables b/lib/unicore/mktables index f584882196..6c13acdec1 100644 --- a/lib/unicore/mktables +++ b/lib/unicore/mktables @@ -10145,6 +10145,28 @@ END } return; } + + sub filter_v6_ucd { + + # Unicode 6.0 co-opted the name BELL for U+1F514, so change the input + # to pretend that U+0007 is ALERT instead, and for Perl 5.14, don't + # allow the BELL name for U+1F514, so that the old usage can be + # deprecated for one cycle. + + return if $_ !~ /^(?:0007|1F514);/; + + my ($code_point, @fields) = split /\s*;\s*/, $_, -1; + if ($code_point eq '0007') { + $fields[$UNICODE_1_NAME] = "ALERT"; + } + elsif ($^V lt v5.15.0) { # For 5.16 will convert to use Unicode's name + $fields[$CHARNAME] = ""; + } + + $_ = join ';', $code_point, @fields; + + return; + } } # End closure for UnicodeData sub process_GCB_test { @@ -14072,7 +14094,12 @@ my @input_file_objects = ( ? \&filter_v1_ucd : ($v_version eq v2.1.5) ? \&filter_v2_1_5_ucd - : undef), + + # And for 5.14 Perls with 6.0, + # have to also make changes + : ($v_version ge v6.0.0) + ? \&filter_v6_ucd + : undef), # And the main filter \&filter_UnicodeData_line, |