http://qs321.pair.com?node_id=11122303


in reply to Converting everything (MySql, perl, CGI, website) to UTF-8

Fabulous contribution. Thanks!

Regarding "every script file is converted to UTF-8 format" -- I am thinking that conversion of the text of Perl scripts from ISO-8859-1 isn't necessary in order to work with Unicode characters in the other ways you've described, unless one wants to be able to directly "type" a Unicode character into the script, e.g.

my $default_name = 'Ǣsop';

Do you agree?

  • Comment on Re: Converting everything (MySql, perl, CGI, website) to UTF-8

Replies are listed 'Best First'.
Re^2: Converting everything (MySql, perl, CGI, website) to UTF-8
by soonix (Canon) on Sep 29, 2020 at 12:27 UTC

    utf8 enables not only Unicode string constants, but also Unicode identifiers (variables, methods, subroutines, …).

    If you use Unicode only in String constants (and only occasionally), then it is even possible to stay in ASCII and use charnames' \N{CHARNAME} sequences, so that e.g.
    my $default_name = '\N{LATIN CAPITAL LETTER AE WITH MACRON}sop';

    would be equivalent to your example. With Perl v5.16 or later, you don't even need to explicitly use charnames for these sequences.

    This approach also avoids problems with several (mostly web) frontends of git (or other) repositories that don't handle Unicode well.