bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: not using OUTPUT_PERL_ENCODING to determine if _stream_encode should


From: Patrice Dumas
Subject: Re: not using OUTPUT_PERL_ENCODING to determine if _stream_encode should encode
Date: Sun, 18 Feb 2024 21:43:17 +0100

On Sun, Feb 18, 2024 at 06:09:23PM +0000, Gavin Smith wrote:
> What you propose sounds reasonable.  I understand the idea of 'convert'
> always returning an unencoded string regardless of output format, although
> the Info converter will have incorrect tag tables so is not a widely
> useful function.  It seems that 'convert' is only used for the test suite,
> am I right?

Indeed, it is only used for the test suite in Texinfo.  It is documented
in Perl modules documentation as being one of the entry point of
converters, but first these modules are more or less internal, and I do
not see anybody using them.

> > A more minor issue, if $self->{'encoding_object'} is not set, it will
> > be retested for 'output_perl_encoding' value each time _stream_encode is
> > called.  Maybe it would be better to set it to 0 or to undef and test if
> > (!exists($self->{'encoding_object'})).
> 
> I don't like the possibility of having $self->{'encoding_object'} being
> either an integer (0) or the result of Encode::find_encoding.  I also
> don't like relying on the distinction between "defined" and "true"
> (0 is defined but not true).  The semantics of "exists" but undefined
> is easy to forget and relying on this would make the code more obscure.
> 
> Does the following look ok?

Looks perfect.

> If this is ok, then "convert" could set $self->{'encoding_disabled'}.

Indeed.

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]