Re: select a variable as stdout and utf8 flag behaviour
[email protected] (Aristotle Pagaltzis) Thu, 10 Nov 2016 10:33:09 +0100
| Newsgroups | perl.unicode |
|---|---|
| Message-ID | <[email protected]> |
* Gert Brinkmann <[email protected]> [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/>