Skip to content

[doc] PerlIO::encoding, error in documentation, FB_PERLQQ et.al. #18907

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

Open
wolfdiem opened this issue Jun 18, 2021 · 8 comments
Open

[doc] PerlIO::encoding, error in documentation, FB_PERLQQ et.al. #18907

wolfdiem opened this issue Jun 18, 2021 · 8 comments
Assignees

Comments

@wolfdiem
Copy link

The documentation of PerlIO::encoding in https://perldoc.perl.org/perl,
v5.34.0 contains an error in the Synopsis section.

The value FB_PERLQQ is not allowed for fallback, as it contains the
'LEAVE_SRC' bit. In addition the 'STOP_AT_PARTIAL' bit is missing,
which is mandatory for use in $PerlIO::encoding::fallback.
Unfortunately this is not contained in any FB_xxx CHECK value, thus
the bits have to be given explicitly.

Thus a valid combination of mask bits should be used, e.g.
'STOP_AT_PARTIAL | PERLQQ'. This also requires to either export
':fallback_all' in "use Encode", or to write the mask bits with
'Encode::...'.

If I understand github #18496 correctly, then the changes there
will enforce a correction of this error internally. But that would
be for v5.34 only, and still the documentation should give correct
values and should be applicable to older versions also.

BTW, if the documentation is changed anyhow, "UTF-8" in the text
further down should be changed to "UTF8", as Perl's internal strings
are loose, not strict. This would make the documentation at bit more
consistent.

As an additional thought: It could be useful to export (or at least
allow the export) of 'ONLY_PRAGMA_WARNINGS' from Encode. This bit is
anyhow included in the default setting of $PerlIO::encoding::fallback,
but it is not available for setting of the variable by the user.

@jkeenan
Copy link
Contributor

jkeenan commented Jun 25, 2021

The documentation of PerlIO::encoding in https://perldoc.perl.org/perl,
v5.34.0 contains an error in the Synopsis section.

Is there someone familiar with PerlIO::Encoding who could review this critique of the documentation?

@Grinnz
Copy link
Contributor

Grinnz commented Jun 25, 2021

@Leont is probably the only person familiar with this module and associated flags

@Leont
Copy link
Contributor

Leont commented Jun 26, 2021

The value FB_PERLQQ is not allowed for fallback, as it contains the
'LEAVE_SRC' bit. In addition the 'STOP_AT_PARTIAL' bit is missing,
which is mandatory for use in $PerlIO::encoding::fallback.
Unfortunately this is not contained in any FB_xxx CHECK value, thus
the bits have to be given explicitly.

You're correct, this is wrong.

BTW, if the documentation is changed anyhow, "UTF-8" in the text
further down should be changed to "UTF8", as Perl's internal strings
are loose, not strict. This would make the documentation at bit more
consistent.

IMHO it shouldn't mention either. As far as Perl code is concerned, internal encoding shouldn't matter.

@jkeenan
Copy link
Contributor

jkeenan commented Oct 7, 2021

The value FB_PERLQQ is not allowed for fallback, as it contains the
'LEAVE_SRC' bit. In addition the 'STOP_AT_PARTIAL' bit is missing,
which is mandatory for use in $PerlIO::encoding::fallback.
Unfortunately this is not contained in any FB_xxx CHECK value, thus
the bits have to be given explicitly.

You're correct, this is wrong.

BTW, if the documentation is changed anyhow, "UTF-8" in the text
further down should be changed to "UTF8", as Perl's internal strings
are loose, not strict. This would make the documentation at bit more
consistent.

IMHO it shouldn't mention either. As far as Perl code is concerned, internal encoding shouldn't matter.

Could someone propose a documentation patch that would address the issues raised in this ticket?

@khwilliamson
Copy link
Contributor

@pali, do you have an idea about this?

@pali
Copy link
Member

pali commented May 18, 2022

@khwilliamson Yes, documentation needs improvements.

@Leont Leont self-assigned this May 18, 2022
@khwilliamson
Copy link
Contributor

@pali, I was hoping since you are more familiar with the operation of this than I am, that you could propose some wording; which I could polish if necessary, me being a native English speaker

@Leont
Copy link
Contributor

Leont commented May 4, 2025

I have since fixed the code so that it automatically filters out the LEAVE_SRC, but for backwards compatibility it's still a good idea to change this in the documentation.

@khwilliamson khwilliamson changed the title [doc] PerlIO::encoding, error in documentation [doc] PerlIO::encoding, error in documentation, FB_PERLQQ et.al. May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants