-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IO::File ignores PERL_UNICODE and PerlIO layer defaults [rt.cpan.org #68366] #17458
Comments
It ignoring the open pragma is expected, as pragmas are lexical. It ignoring |
@cosmicnet see above. |
It would appear that both of these only affect the topmost scope, it sets the correct encodings for that lexical scope. So that would mean this isn't a bug in the IO dist, but in core. |
This was 9 years ago, so hard for me to remember exactly. But I do recall messing around with a lot of different stuff with IO layers which just didn't work, when I dug deeper IO::File was ignoring a lot/all of those settings. When I changed to regular open() everything worked as expected. Unfortunately I don't have scope to put together a test case for this at the moment. |
It does say:
but that's pretty vague for a command-line option. Changing its behaviour to be global would probably break existing code. |
One way it would be made to work (ignoring the -C issue) is to check the calling scope's These members of |
Yeah, especially because that's not at all what I would expect it to do.
True. TBH the whole concept of |
I just came across this in some code I was working on at the time: my $outfile = new IO::File;
$outfile->open(">$filepath") || die( "Cannot open file '" . decode( 'utf8', $filepath ) . "' for output" );
#$PerlIO::encoding::fallback = Encode::FB_DEFAULT; # This didn't work for some reason
binmode( $outfile, ':encoding(utf8)' ); |
Further clarified it has no effect on modules. Clarifies a documentation nit discussed in Perl#17458
Further clarified it has no effect on modules. "main program scope" is even clearer, credit to github comments. Clarifies a documentation nit discussed in Perl#17458
Further clarified it has no effect on modules. "main program scope" is even clearer, credit to github comments. Clarifies a documentation nit discussed in #17458
Migrated from rt.cpan.org#68366 (status was 'new')
Requestors:
From [email protected] on 2011-05-22 02:59:48:
The text was updated successfully, but these errors were encountered: