Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^7: Default encoding rules leave me puzzled...

by Anonymous Monk
on Jun 21, 2014 at 13:37 UTC ( #1090767=note: print w/replies, xml ) Need Help??


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
      $
      

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1090767]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2018-01-23 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (240 votes). Check out past polls.

    Notices?