summaryrefslogtreecommitdiff
path: root/lib/charnames.pm
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-31 20:50:23 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-31 20:50:23 +0000
commita23c04e41e8e54701da113d9309ef79fb888afe6 (patch)
treeddbe8a2b3337b8379be052ad2687ea07bfd9254a /lib/charnames.pm
parent4a66ea5a3f06b7d87684264c54e3021d40406dc8 (diff)
downloadperl-a23c04e41e8e54701da113d9309ef79fb888afe6.tar.gz
Behaviour (make viacode 0xFFFE to return BYTE ORDER MARK,
make viacode no-allocatedcode to return the 0xFFFD) tweaks, respective test and doc tweaks. p4raw-id: //depot/perl@15637
Diffstat (limited to 'lib/charnames.pm')
-rw-r--r--lib/charnames.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm
index 2217f6fa2a..80f31e7eba 100644
--- a/lib/charnames.pm
+++ b/lib/charnames.pm
@@ -208,8 +208,11 @@ sub viacode
if ($txt =~ m/^$hex\t\t(.+)/m) {
return $viacode{$hex} = $1;
+ } elsif ($hex eq 'FFFE') {
+ return $viacode{$hex} = "BYTE ORDER MARK";
} else {
- return;
+ carp "Unknown charcode '$hex'";
+ return "\x{FFFD}";
}
}
@@ -254,8 +257,8 @@ charnames - define character names for C<\N{named}> string literal escapes.
use charnames qw(cyrillic greek);
print "\N{sigma} is Greek sigma, and \N{be} is Cyrillic b.\n";
- print charname::viacode(0x1234); # prints "ETHIOPIC SYLLABLE SEE"
- printf "%04X", charname::vianame("GOTHIC LETTER AHSA"); # prints "10330"
+ print charnames::viacode(0x1234); # prints "ETHIOPIC SYLLABLE SEE"
+ printf "%04X", charnames::vianame("GOTHIC LETTER AHSA"); # prints "10330"
=head1 DESCRIPTION
@@ -397,9 +400,8 @@ will also give a warning about being deprecated.
=head1 ILLEGAL CHARACTERS
-If you ask for a character that is illegal (like the byte order mark
-U+FFFE, or the U+FFFF) does not exist, a warning is given and the
-special Unicode I<replacement character> "\x{FFFD}" is returned.
+If you ask for a character that does not exist, a warning is given
+and the Unicode I<replacement character> "\x{FFFD}" is returned.
=head1 BUGS