##
## 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].
sub viacode
{
if (@_ != 1) {
- carp "charnames::viacode() expects one numeric argument";
+ carp "charnames::viacode() expects one argument";
return ()
}
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}";
=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
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.
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);
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";