in reply to Re: Using "binmode ???, ':encoding(UTF-8)" on the result from "qx//" ?
in thread Using "binmode ???, ':encoding(UTF-8)" on the result from "qx//" ?

Thx! Anonymous++ ;)

Cheers Rolf

  • Comment on Re^2: Using "binmode ???, ':encoding(UTF-8)" on the result from "qx//" ?

Replies are listed 'Best First'.
Re^3: Using "binmode ???, ':encoding(UTF-8)" on the result from "qx//" ?
by Anonymous Monk on Mar 31, 2010 at 20:18 UTC
    On a related note , in case anyone was wondering, that doesn't affect the DATA filehandle
      That's not quite accurate.
      $ perl 832144.pl GLOB(0x84250b8) unix GLOB(0x84250b8) perlio GLOB(0x8248600) unix GLOB(0x8248600) perlio GLOB(0x8248600) encoding(utf-8-strict) GLOB(0x8248600) utf8 GLOB(0x82610d8) unix GLOB(0x82610d8) perlio $ perl -e'use open qw( :std IO :encoding(UTF-8) ); do $ARGV[0];' 83214 +4.pl GLOB(0x84dbdc8) unix GLOB(0x84dbdc8) perlio GLOB(0x84dbdc8) encoding(utf-8-strict) GLOB(0x84dbdc8) utf8 GLOB(0x82ff610) unix GLOB(0x82ff610) perlio GLOB(0x82ff610) encoding(utf-8-strict) GLOB(0x82ff610) utf8 GLOB(0x8570378) unix GLOB(0x8570378) perlio

      The DATA handle is actually the one the parser uses to read the source. use open won't affect the DATA of the file in which the use open occurs since it was opened before the use open was encountered.

      use utf8;, on the other hand, will affect the local DATA. You could get some "interesting" interactions.

      Your best bet is

      binmode(DATA, ':encoding(UTF-8)');