in reply to Re^6: Default encoding rules leave me puzzled...
in thread Default encoding rules leave me puzzled...

OMG so that's probably what Perl actually does.
Converts in-place the internal representation of the string from UTF-X to the equivalent octet sequence in the native encoding (Latin-1 or EBCDIC).
Yeah, binary print works exactly like utf8::downgrade.
  • Comment on Re^7: Default encoding rules leave me puzzled...

Replies are listed 'Best First'.
Re^8: Default encoding rules leave me puzzled...
by Anonymous Monk on Jun 21, 2014 at 13:48 UTC
    Except it doesn't convert in place...
    perl -MEncode=encode -wE 'use utf8; my $c = q(Français); say $c; say e +ncode("utf-8", $c)'
    It encodes the string to Latin-1. Or EBCDIC. Case closed.

      Huh?

      $ chcp
      Active code page: 437
      $ perl -MEncode=encode -wE 'use utf8; my $c = q(Français); say $c; say encode("utf-8", $c)'
      Wide character in say at -e line 1.
      Franτais
      Fran�ais
      $