in reply to Unknown charnames when building Encode
G'day yulivee07,
My Perl (Mac OS X):
$ perl -v | head -2 | tail -1 This is perl 5, version 24, subversion 0 (v5.24.0) built for darwin-th +read-multi-2level
Both 'LATIN SMALL LETTER SHARP S' and 'POUND SIGN' are valid and work for me:
$ perl -C -E 'say "\N{LATIN SMALL LETTER SHARP S}"'
ß
$ perl -C -E 'say "\N{POUND SIGN}"'
£
"It seems AIX perl is unable to find the \N{alpha} character. I am a bit lost here - where does perl usually search for characters like this?"
Without additional code, 'alpha' doesn't work by itself. I get the same error as you:
$ perl -C -E 'say "\N{alpha}"' Unknown charname 'alpha' at -e line 1, within string Execution of -e aborted due to compilation errors.
You can use 'greek:alpha':
$ perl -C -E 'say "\N{greek:alpha}"'
α
I note from the source of t/Encode.t:
use charnames qw(greek);
That also works for me (see charnames):
$ perl -Mcharnames=greek -C -E 'say "\N{alpha}"'
α
"Can someone provide some debugging tips? "
When running any tests, bear in mind that different versions of Perl support different levels of Unicode:
I note from your "perl -V" output, that @INC contains some 5.8.8 paths before 5.20.1 paths. It's possible that old versions of Unicode-related modules are being found first.
Take a look in the code (*.pm, *.t, etc.) shown in your error messages for modules being used, then check which versions you have. For instance, I have
$ perl -E 'use charnames (); say $charnames::VERSION' 1.43
For Perl 5.20.1, that should be 1.40; for 5.8.8 it should be 1.05. You can go to the latest distribution (http://search.cpan.org/~shay/perl-5.24.1/); use the dropdown list to select 5.20.1, 5.8.8, or any other version; then follow the link to the wanted module (e.g. charnames).
You can test whether your system recognises any named characters by using their codepoints:
$ perl -C -E 'say "\x{3b1} - \x{df} - \x{a3}"'
α - ß - £
Unicode::UCD might provide some useful information. For instance, to check which version of Unicode that a character first appeared in:
$ perl -MUnicode::UCD=charprops_all -E 'say charprops_all("U+$_")->{Ag +e} for qw{3b1 df a3}' V1_1 V1_1 V1_1
For any of the tests above, you could try manipulating @INC first, e.g. move the 5.8.8. paths to the end of the list.
Also, it could be helpful to know exactly what your build process is: manual, cpan, etc.
See also: any links in http://perldoc.perl.org/perl.html with descriptions matching /Unicode/; http://www.unicode.org/.
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unknown charnames when building Encode
by yulivee07 (Sexton) on Jan 19, 2017 at 15:02 UTC | |
by kcott (Archbishop) on Jan 20, 2017 at 15:08 UTC | |
by yulivee07 (Sexton) on Jan 23, 2017 at 12:39 UTC |