On Tue, 9 Feb 2010 10:21:42 +0100, "H.Merijn Brand"
<h.m.brand@xs4all.nl> wrote:
> On Mon, 08 Feb 2010 23:40:32 +0100, Slaven Rezic <slaven@rezic.de>> wrote:> > > "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:> > > > >> > > To prevent double encoding, is it possible to `see' (from XS) that the> > > stream is opened with something like> > >> > > open my $dst, ">:utf8", "file";> > > or> > > open my $dst, ">:encoding(utf8)", "file";> > > or> > > open my $dst, ">", "file";> > > binmode $dst, ":encoding(utf8)";> > >> > > ?> > > > Check the output of PerlIO::get_layers($dst).> > Right, so is this a bug:> --8<---> use strict;> use warnings;> > use Data::Peek;> > my $out = "";> open my $fh, ">:utf8", \$out;> > DDumper [ PerlIO::get_layers ($fh, details => 1) ];> -->8---FWIW: This looks more sane:
open my $fh, ">:encoding(utf8)", \$out;
=>
$VAR1 = [
'scalar',
undef,
6296064,
'encoding',
'utf8',
4231680
];
> =>
>
> $VAR1 = [
> 'scalar',
> undef,
> 6328832
> ];
>
> Where is my "utf8" layer?
>
--
H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/
http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/