Newsgroups: perl.unicode Path: csiph.com!feeder.erje.net!1.us.feeder.erje.net!news.ripco.com!news.glorb.com!usenet.stanford.edu!nntp.perl.org Return-Path: Mailing-List: contact perl-unicode-help@perl.org; run by ezmlm Delivered-To: mailing list perl-unicode@perl.org Received: (qmail 15878 invoked from network); 10 Nov 2016 09:33:23 -0000 Received: from x1.develooper.com (207.171.7.70) by x6.develooper.com with SMTP; 10 Nov 2016 09:33:23 -0000 Received: (qmail 27898 invoked by uid 225); 10 Nov 2016 09:33:23 -0000 Delivered-To: perl-unicode@perl.org Received: (qmail 27894 invoked by alias); 10 Nov 2016 09:33:23 -0000 X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: la.mx.develooper.com Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.20) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 10 Nov 2016 01:33:15 -0800 Received: from localhost ([87.79.78.105]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0LtlG5-1cm6oy43rZ-011C6o for ; Thu, 10 Nov 2016 10:33:10 +0100 Date: Thu, 10 Nov 2016 10:33:09 +0100 To: perl-unicode@perl.org Subject: Re: select a variable as stdout and utf8 flag behaviour Message-ID: <20161110093308.GA38181@plasmasturm.org> References: <90839dbc-288d-dff6-af0b-f98c8e62480d@netcologne.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <90839dbc-288d-dff6-af0b-f98c8e62480d@netcologne.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:GgaXxcNFJkKtbvQ1Mu4YzQpzfWR1V0b09gzyToPPTbpaaPhqxeM BjHcHBqa3uMR41hPQHAsLGVAdn6LD8ESZvRZ5aOGV6PotIpSTK0BqCmT0i2v20QpIUznbcD INKkvUF7UC+IUnTcrRaPK2ww5wVgOWnKlVr4UA3EpzTzefpRTgOLwQPsqHSO67LZlKVyprR 4TNDnhEGB8yfNHhB2YOAQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:qZ5SRkfDDnE=:0zIyGm2n5KevUJPE2r1lvF jJBL61W725dJVt/yGdZ4CGm5iuf3c2JveLM2R9QVXqvg20OhucubfT5EQOIS5Ty6jPNJkfio1 Dym+NecDOxHByf9IBeOB+YRkAr/KnFBfgXxekx2lQQYIRohhKZdKcHwXzVKDhmSR6kYI53U5L UVwGR3fgSp8QzIkZzKbZjzSVnd8I/d0M1TuA0+VxS//RG0aoqax3QVOWys34wWRQYrhJl3xiS C9ta3i4eC1datW6a0D9QBiQWhyvLxJCtDlXdR4LDMqtDDTscMvVr8JNp4brcggNMh3TGSnOVJ wKL9sg0zsZe9J99TLFZPUggQkZ/aPxpMhcAbMuX9hmDDFUwV6YKECnoUahOQPQH9FvqDoeHuu /ap5VOOiwes2ymYEucCrvMGvobif8S6z3h0DWzpTneG2pFpfQ9usfd5SiL6DaQAlJUo90ORUC MfUjeC+WtCmWMGfGO6NBmoZHJbAsNHdmj8lIUgYvHKfP/C+wCNbgrfN5u1PQp1JXQDMZFTrcQ 8c744RaHjbQW6fky1pQZbdlOTCLYiokFrQhRnpkNkTR4aAb7+h3H3jp33Be1Z0RYxMkhETpNz iaoWhf7bS+T8Mf2HNuPvqyM/Zhkqre8SQQDnsqXeAV2ekVeyUpC5dcsqZ5etP5L7xzRyQPjmR ggyL5wEaaoZ0rx9E6cn27vg6dVjOdGBDNy+ud8NzduLpfGtMbo6k5Sm2lVJ8apBGodrMD5/z8 yQoclNWLj4oYCcexzA6QPKGV2w6+/5JX0TtC0qwVOdSWbuphWoJ7CYDYkHA= Approved: news@nntp.perl.org From: pagaltzis@gmx.de (Aristotle Pagaltzis) Xref: csiph.com perl.unicode:233 * Gert Brinkmann [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 //