<?xml version="1.0" encoding="windows-1252"?>
<node id="1014823" title="changing STDOUT encoding and fork CRASH" created="2013-01-22 21:30:03" updated="2013-01-22 21:30:03">
<type id="115">
perlquestion</type>
<author id="927538">
wolf391</author>
<data>
<field name="doctext">
could someone shed some light why this program CRASHES the perl interpreter 
(win7, perl 5.12.4 32bit)

&lt;code&gt;
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say switch);
use utf8;

binmode( STDOUT, ':encoding(cp1252)');

my $pid = fork; die "Failed to fork: $! \n" unless defined $pid;

if ($pid) {
	say 'äbökü€';
	wait;
	exit 0;
}

say 'äbökü€';
exit 0;
&lt;/code&gt; 

while THIS works just fine:

&lt;code&gt;
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say switch);
use utf8;

my $pid = fork; die "Failed to fork: $! \n" unless defined $pid;

if ($pid) {
	binmode( STDOUT, ':encoding(cp1252)');
	say 'äbökü€';
	wait;
	exit 0;
}

binmode( STDOUT, ':encoding(cp1252)');
say 'äbökü€';
exit 0;
&lt;/code&gt;

really can't wrap my head around why the first example crashes. 
</field>
</data>
</node>
