On Sat, Jan 7, 2017 at 9:55 PM, Bill Moseley <mose...@hank.org> wrote:
> > # Let it be set to undef > if (my $wanted = shift) { > $encoding = Encode::find_encoding($wanted) > or Carp::croak( qq/Unknown encoding '$wanted'/ ); > *binmode(STDERR, ':encoding(' . $encoding->name . ')');* > > > The problem with that is it seems to turn off autoflush on STDERR. In my > case that is causing intermixing of lines in the log files. > > If I turn on STDERR->autoflush(1) then the logging works again and log > lines are not mangled. > > But, I'm not sure we should apply a layer to STDERR like that. For > example, I log to stderr with JSON and that is already encoded. > Just in case it isn't clear that is a problem: use strict; use warnings; use Encode; use JSON; binmode( STDERR, ':utf8' ); my $json = encode_json( { chars => decode_utf8( '雨下降' ) } ); print STDERR "$json\n"; Results in: {"chars":"é›¨ä¸‹é™ "} -- Bill Moseley mose...@hank.org
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/