-
Notifications
You must be signed in to change notification settings - Fork 566
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
$PerlIO::encoding::fallback = FB_DEFAULT leads to duplicated output #7309
Comments
From aa29@mail.ruTo: perlbug@perl.org This is a bug report for perl from aa29@mail.ru, $PerlIO::encoding::fallback = FB_DEFAULT leads to duplicated output. It is possible to change check-mode via $PerlIO::encoding::fallback: use Encode qw(:fallback_all); $PerlIO::encoding::fallback = FB_DEFAULT; binmode(STDERR, ":encoding(cp866)"); This code gives four messages instead of one: foobar at 6.pl line 7. And with redirection STDERR to file it gives three messages: foobar at 6.pl line 7. Further investigation shows that there is no duplication if Looking into ext\Encode\Encode.xs I found such code if (check && !(check & ENCODE_LEAVE_SRC)){ If check is set to FB_DEFAULT (which is 0) and no other fallback is Flags: Site configuration information for perl v5.8.4: Configured by aa29 at Mon May 17 17:59:46 2004. Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Locally applied patches: @INC for perl v5.8.4: Environment for perl v5.8.4: PATH=C:\cygwin\bin;C:\Tcl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Syst aa29 |
From ambrus@math.bme.huOn Wed May 19 08:34:56 2004, aa29 wrote:
This old bug still exists in bleadperl (as of a few days ago). It also
|
The RT System itself - Status changed from 'new' to 'open' |
From ambrus@math.bme.huBesides printing duplicate output, a filehandle with an encoding layer I attach a test script that tests whether this bug is still present: Ambrus |
@Leont does that mean you're looking at this issue then? |
I have some ideas, but it may require some work on the |
OK. I’m gonna put your name on it so we know who is involved |
Thanks to @Leont this issue should be resolved in Perl 5.34.0 and later. The solution allows you to set whatever value you like for WorkaroundFor versions before Perl 5.34.0, always clear the $PerlIO::encoding::fallback = (($fallback) & ~Encode::LEAVE_SRC()) | Encode::STOP_AT_PARTIAL(); (tested with Perl 5.30.2 on Windows 10, Perl 5.30.3 on Ubuntu 20.04 LTS for WSL2, and Perl 5.28.1 on Debian Buster) BackgroundWhen I encountered this issue a couple of days ago, I was trying to set After some experimentation I discovered that clearing the Unhappy at having to hack a solution with an "unused" bit that may someday get used, I dug in to the code for Looking at various different version of Perl going back through the years, it is clear that the default value for |
Yeah, this is solved. |
Migrated from rt.perl.org#29720 (status was 'open')
Searchable as RT29720$
The text was updated successfully, but these errors were encountered: