Skip Menu |

This queue is for tickets about the IPC-Run CPAN distribution.

Report information
The Basics
Id: 58853
Status: resolved
Priority: 0/
Queue: IPC-Run

Owner: Nobody in particular
Requestors: tino.didriksen+ipcrun [...]

Bug Information
Severity: Important
Broken in: 0.89
Fixed in: (no value)

Subject: Pumping UTF-8 data mangles it
Download (untitled) / with headers
text/plain 679b
Attached is a self-contained test script that shows how pump does not manage to send all UTF-8 data to the child, despite the environment vars PERL_UNICODE=SDA LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 being set. I tried looking through IPC/ and by adding "use bytes;" to _write() that part will at least send the data correctly. However, I couldn't get it to read back the output from the child as UTF-8; it just reads the raw bytes interpreted as ISO-8859-1, and forcing all _read() strings to UTF-8 seemed like a really bad idea... Somewhere there must be a place where it does not respect the global binmode, since PERL_UNICODE=SDA should force all I/O to UTF-8 semantics.
text/x-perl 847b
#!/usr/bin/perl # Runtime environment: export LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 PERL_UNICODE=SDA BEGIN { $| = 1; } use utf8; use strict; use warnings; if (! defined $ENV{IPC_SUB_PROCESS}) { $ENV{IPC_SUB_PROCESS} = 1; use IPC::Run qw( start pump finish timeout binary ); my $in; my $out; my @cmd = (__FILE__); my $h = start \@cmd, \$in, \$out, timeout(2); my @lines = ("abc", "料理教室", "æøå"); foreach my $line (@lines) { print "Handler input: $line\n"; $in = $line; $in .= "\n"; pump $h until $out =~ /.+/s; print "Handler output: $out\n"; $out = ''; } } else { while (my $line = <STDIN>) { $line =~ s/^\s+//g; $line =~ s/\s+$//g; print STDERR "Daemon input/output: ", $line, "\n"; print $line, "\n"; } }
Download (untitled) / with headers
text/plain 356b
On Sat Jun 26 14:22:07 2010, wrote: Show quoted text
> PERL_UNICODE=SDA LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 being set. >
I think IPC::Run should test the locale. If UTF-8 is used, call binmode(":utf8") on all pipe filehandles *before* using them. See perldoc -f binmode for more details.
Ticket migrated to github as

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to