diff options
author | Philip Newton <pne@cpan.org> | 2002-04-01 19:06:18 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-01 14:22:14 +0000 |
commit | 274085e3d0d92fea31afce1cf16bad209874ec70 (patch) | |
tree | fdb8474187162f1a1d3a61df720c444d526a8a07 /lib | |
parent | 07215cb701e0c6c4b314a6019622b10f189177c5 (diff) | |
download | perl-274085e3d0d92fea31afce1cf16bad209874ec70.tar.gz |
BOM, 0xFFFE, 0xFEFF, etc.
Message-ID: <aptgauk21cvnpiotsrm3gaul98j2dqsj9p@4ax.com>
p4raw-id: //depot/perl@15656
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charnames.pm | 13 | ||||
-rw-r--r-- | lib/charnames.t | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm index 3209f29fb0..549a8c2051 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -104,7 +104,7 @@ sub charnames ## ## Now know where in the string the name starts. - ## The code, in hex, is befor that. + ## The code, in hex, is before that. ## ## The code can be 4-6 characters long, so we've got to sort of ## go look for it, just after the newline that comes before $off[0]. @@ -181,7 +181,7 @@ my %viacode; sub viacode { if (@_ != 1) { - carp "charnames::viacode() expects one numeric argument"; + carp "charnames::viacode() expects one argument"; return () } @@ -208,8 +208,6 @@ sub viacode if ($txt =~ m/^$hex\t\t(.+)/m) { return $viacode{$hex} = $1; - } elsif ($hex eq 'FEFF') { - return $viacode{$hex} = "BYTE ORDER MARK"; } else { carp "Unknown charcode '$hex'"; return "\x{FFFD}"; @@ -244,7 +242,7 @@ __END__ =head1 NAME -charnames - define character names for C<\N{named}> string literal escapes. +charnames - define character names for C<\N{named}> string literal escapes =head1 SYNOPSIS @@ -336,9 +334,12 @@ prints "FOUR TEARDROP-SPOKED ASTERISK". Returns undef if no name is known for the code. -This works only for the standard names, and does not yet aply +This works only for the standard names, and does not yet apply to custom translators. +Notice that the name returned for of U+FEFF is "ZERO WIDTH NO-BREAK +SPACE", not "BYTE ORDER MARK". + =head1 charnames::vianame(code) Returns the code point indicated by the name. diff --git a/lib/charnames.t b/lib/charnames.t index 730ce1805a..1beecf3f71 100644 --- a/lib/charnames.t +++ b/lib/charnames.t @@ -193,7 +193,7 @@ print "ok 30\n"; print "not " unless "\N{NEL}" =~ $nel; print "ok 31\n"; -print "not " unless "\N{BYTE ORDER MARK}" eq chr(0xFFFE); +print "not " unless "\N{BYTE ORDER MARK}" eq chr(0xFEFF); print "ok 32\n"; print "not " unless "\N{BOM}" eq chr(0xFEFF); @@ -217,6 +217,6 @@ print "ok 33\n"; print "ok 37\n"; } -print "not " unless charnames::viacode(0xFEFF) eq "BYTE ORDER MARK"; +print "not " unless charnames::viacode(0xFEFF) eq "ZERO WIDTH NO-BREAK SPACE"; print "ok 38\n"; |