in reply to can not use utf8 with File::Slurp
Looking at File::Slurp, it thinks binmode is only for cr/lf translation. It is broken that way, because it never calls binmode but does some fiddling with O_ flags and sysopen instead. I think it completely ignores PerlIO in favour of speed. My recommendation is to replace File::Slurp with:
sub write_file_utf8 { my $name = shift; open my $fh, '>:encoding(UTF-8)', $name or die "Couldn't create '$name': $!"; local $/; print {$fh} $_ for @_; };
This likely is a bit slower, but likely it works, as opposed to File::Slurp. You might also want to open a bug against File::Slurp.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: can not use utf8 with File::Slurp
by ikegami (Patriarch) on Feb 15, 2011 at 17:18 UTC |