in reply to How to display/accept unicode chars in a tk entry widget

I prefer charnames over utf8.

Sure, the latter allows you to use characters from the extended character set directly in your source code, even in function or variable names.

However, when working in a mixed environment, or collaborating/sharing over different architectures, many editors (and viewers) have different display settings. Most of these don't understand the in-band signalling that is "use utf8", especially if web viewers or Perlmonks come into the mix.

Of course, if all is correctly configured,
use utf8; my $str = "09 Handel_ Water Music Suite - Bouré.m4a";
is easier to read than
# use charnames if your Perl is older than 5.16 my $str = "09 Handel_ Water Music Suite - Bour\N{LATIN SMALL LETTER E +WITH ACUTE}.m4a";
Tis is also helpful for languages where your coworker or maintainer is unfamiliar with. For me,Of course, YMMV, as always.

Replies are listed 'Best First'.
Re^2: How to display/accept unicode chars in a tk entry widget
by CrashBlossom (Beadle) on Jul 01, 2023 at 14:11 UTC

    Thanks for your response

    I use charnames when I create the string myself, but in this case the string was a filename which was read from a directory.

      The pragma utf8 fixes your example, but I would not expect it to help with a file name that you read. In that case, you probably have to decode the file name.
      Bill