My apologies, hit send too soon: On Tue, 3 Aug 2021 at 01:23, Tom Molesworth <tom@deriv.com> wrote: > On Tue, 3 Aug 2021 at 01:17, Felipe Gasper <felipe@felipegasper.com> > wrote: > >> >> ----- >> use v5.36; >> use Encode; >> print Encode::encode_utf8('Hello, world!'); >> ----- >> >> ⦠and any ensuing explanation will have to discuss character encoding, >> and the fact that Perl canât tell text from bytes. Right away this simple >> example draws attention to one of Perlâs more frustration-prone qualities. >> >> Respectfully, I just canât see how this improves the language, and Iâm >> surprised more folks arenât voicing similar thoughts. Iâd love to be wrong; >> I guess weâll see. >> > > In core, the official answer is "use utf8" with "binmode": > > https://perldoc.perl.org/perluniintro > > Outside core Perl, one of the commonly shared guides is > > ... this summary by tchrist: https://stackoverflow.com/a/6163129 A general mantra of "transcode at the edges" is something I personally find more helpful than adding encode/decode operations throughout the core of the code. Enabling utf8 by default (lexical scope) conflicts with our inability to enable the `encoding(UTF-8)` binmode by default (global scope). Nice as utf8-everywhere might be - for some use-cases, at least - I don't think there has been any viable option provided to resolve this?Thread Previous | Thread Next