Groups | Search | Server Info | Login | Register


Groups > perl.unicode > #233

Re: select a variable as stdout and utf8 flag behaviour

Newsgroups perl.unicode
Date 2016-11-10 10:33 +0100
Subject Re: select a variable as stdout and utf8 flag behaviour
Message-ID <20161110093308.GA38181@plasmasturm.org> (permalink)
References <90839dbc-288d-dff6-af0b-f98c8e62480d@netcologne.de>
From pagaltzis@gmx.de (Aristotle Pagaltzis)

Show all headers | View raw


* Gert Brinkmann <g111@netcologne.de> [2016-11-09 16:00]:
> open(my $fh, '>:encoding(UTF-8)', \$html);
> my $orig_stdout = select( $fh );
> print "Ümläut Test ßaß; 使用下列语言\n";

Think of it this way:

Those three lines of code are an elaborate way of doing this:

    $html = Encode::encode('UTF-8', "Ümläut Test ßaß; 使用下列语言\n");

If you wrote that code, would you be surprised that $html does not
have the UTF8 flag set afterwards?

Bonus question if you are not surprised then: what is the difference
between these two cases that makes your argument that “perl knows what
I put in there so it should know to set the UTF8 flag on it” not apply
to this?

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Back to perl.unicode | Previous | NextPrevious in thread | Find similar


Thread

select a variable as stdout and utf8 flag behaviour g111@netcologne.de (Gert Brinkmann) - 2016-11-09 15:55 +0100
  Re: select a variable as stdout and utf8 flag behaviour pali@cpan.org - 2016-11-09 16:20 +0100
    Re: select a variable as stdout and utf8 flag behaviour g111@netcologne.de (Gert Brinkmann) - 2016-11-09 19:46 +0100
      Re: select a variable as stdout and utf8 flag behaviour pali@cpan.org - 2016-11-09 21:34 +0100
  Re: select a variable as stdout and utf8 flag behaviour pagaltzis@gmx.de (Aristotle Pagaltzis) - 2016-11-10 10:33 +0100

csiph-web