> -----Ursprüngliche Nachricht-----
> Von: markjreed@gmail.com [mailto:markjreed@gmail.com]Im
> Auftrag von Mark
> J. Reed
> Gesendet: Mittwoch, 23. April 2008 19:10
> An: perl5-porters@perl.org
> Betreff: Specify i/o encoding != code encoding in one-liner?
>
>
> How can I tell Perl that its standard/file input is, say, UTF-16,
> without also having it also try to interpret its code as UTF-16?
>
> Things I thought of:
>
> 1. Is there any way via -m/-M to specify the equivalent of
> this use decl?
>
> use encoding UTF-8, STDIN => UTF-16LE, STDOUT => UTF-16LE;
>
> 2. Alternatively, will something like this work?
>
> perl -e 'BEGIN { open ARGV, '<:encoding(UTF-16LE)', <&ARGV; } ... '
>
> Any other suggestions?
The PERLIO env var?
$ PERLIO=':stdio:crlf' /opt/MISperl/bin/perl -le '$,=$"; \
> print PerlIO::get_layers \*STDIN'
stdio crlf
But that does not seem to work with the :encoding layer :-(
$ PERLIO=':encoding(latin1)' /opt/MISperl/bin/perl -le '$,=$"; \
> print PerlIO::get_layers \*STDIN'
unix perlio
Is this known/documented/a bug ?
Thread Previous
|
Thread Next