karlgoethebier has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

i have no idea why this example doesn't work as expected:

#!/usr/bin/env perl + + use warnings; use strict; use charnames qw(:full); binmode STDOUT, ":utf8"; print chr( charnames::vianame( qq(MUSIC FLAT SIGN)) ) . qq(\n); print chr( charnames::vianame( qq(GREEK CAPITAL LETTER DELTA)) ) . qq(\n); __END__

On my box Δ is printed and ♭ not (LANG=de_DE.UTF-8).

Update: If i switch my Console font to Apple Symbol it works:

my $flat = chr( charnames::vianame(qq(MUSIC FLAT SIGN)) ); print qq(b$flat);
b♭

Observation: If i paste this output from Console to TextEdit and select any available font it is displayed correct. Things It's getting weird...

Thanks for any hint and best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re: char names: why can i print GREEK CAPITAL LETTER DELTA but not MUSIC FLAT SIGN?
by Corion (Patriarch) on Oct 03, 2014 at 20:30 UTC

    Have you verified that your Perl script outputs the expected bytes?

    perl -w 1102776.pl | od -x

    The above should show you the raw bytes (encoded as hex). There also is Unicode::Tussle, which I think also contains some programs for debugging your output, but I don't find anythink immediately relevant in its documentation.

    Maybe your console font does not support MUSICAL FLAT SIGN. Does it support PILE OF POO ?

      Hi Corion, thanks for your reply.

      PILE OF POO is supported and hex dump shows e2 99 ad which should be correct. Font is Andale Mono.

      According to fileformat.info MUSICAL FLAT SIGN is missing in this font. But other musical symbols like EIGHTH NOTE a.s.o are supported.

      Seems like i need another font.

      Thank you very much for your advice and best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      Maybe your console font does not support MUSICAL FLAT SIGN. Does it support PILE OF POO ?

      Hmmm, MUSICAL FLAT SIGN => PILE OF POO curious tangential connection.



        "...curious tangential connection"

        Well, now that you say it, indeed :-)

        Regards, Karl

        «The Crux of the Biscuit is the Apostrophe»