in reply to unicode, \N, \x, character encoding

\N escapes are seen pre-interpolation (update: rather, at the same time as variable interpolation, which means the \N{...} is parsed as an entire entity, and the contents are treated as raw data). I suggest chr(charnames::vianame($name)).

Update: you could also use eval() as shown below, but I think my previous solution is far more appropriate.

sub charname_to_char { my $name = shift; eval qq{ # because $^H{charnames} doesn't propogate into here use charnames ':full'; "\\N{$name}" }; }

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: unicode, \N, \x, character encoding
by caseyperkins (Initiate) on Mar 02, 2006 at 20:06 UTC
    Hi Jeff,
    It worked! Your help is greatly appreciated.
    :-)

    Casey