perlboy_emeritus has asked for the wisdom of the Perl Monks concerning the following question:
I believe I’ve found a bug in chr,
perl -v (v5.18.2) built for darwin-thread-multi-2level (with 2 registered patches
Running in macOS 10.13.3
I’m working with external geodesic data in UTF-8, so my code includes, such as:When I inspect some of my variables, either in debugger or withuse utf8; # Required if using Unicode strings. ... open(FH, "<:encoding(UTF-8)", "$fileName") || die "Can't open $fileName: $!\n";
The chr statement returns ‘?’ while the print statement returns the Unicode expressions:print "Three required utf8 chars:\n \x{B0}\n \x{2032}\n \x{2033}\n"; print chr(0xB0), "\n";
Three required utf8 chars: ° ′ ″ ?
The print statement is correct, the chr is not. Please advise?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Potential bug in chr
by roboticus (Chancellor) on Feb 05, 2018 at 00:58 UTC | |
by perlboy_emeritus (Scribe) on Feb 05, 2018 at 01:25 UTC | |
by ikegami (Patriarch) on Feb 05, 2018 at 01:31 UTC |