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


In reply to Re: Unknown charnames when building Encode by kcott
in thread Unknown charnames when building Encode by yulivee07

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.